How to avoid leaving money on the table with salary negotiation

Although any sort of negotiation can be stressful, negotiating compensation for a new job—especially when you have the opportunity to get paid to work on open source software—can be especially intimidating. Because of this, many people, particularly women and minorities, choose not to negotiate at all. Unfortunately, this choice may come with a $500,000 penalty. That’s how much money the average person loses throughout their lifetime by choosing not to negotiate their wages.

Talking about the importance of wage negotiation in America is impossible without talking about the wage gap for women and minorities. A few years ago, the big buzz was about “79 cents to the dollar” that women were paid in comparison to men. Data show that the U.S. pay gap has improved marginally, and women are now on average receiving 80 cents to the male dollar. This number varies by location, and ground is being lost in some places. The disparity is even worse for women of color and other marginalized groups. We don’t even have statistics for the difficulties experienced by transgender and gender-nonconforming people, who often face some of the most severe barriers in the workplace.

Makes you look at your paycheck a little differently, doesn’t it?

Don’t let it get you down, though. Although there is a lot that must be done at the corporate and social policy levels, you can help improve your own situation by choosing to negotiate. Making that choice isn’t always easy when you’re fresh out of school or new to the industry and only have open source contributions to showcase your skills. But, once you decide to negotiate—and learn how to do it well—a lot can change. For example, last year I made the choice to negotiate my salary and increased my monthly take-home pay by more than 50%. It wasn’t easy. There was a risk it could backfire, but with a little courage and elbow grease, the result was certainly worth the effort.

Remember: If you don’t ask, you don’t get.

Like the idea, but not sure where to start? Try negotiating on small things that don’t matter. Start frequenting yard sales and flea markets. Negotiate when you buy something, just to practice your skills. This will help boost your confidence and get you used to the process. Focus on what you can gain, not what you can lose. Recognize that the process is a bit of a game, and you can have fun in the interaction. Remember: If you don’t ask, you don’t get.

I like to think of negotiation as a two-phase process: Phase One happens before the offer, sometimes even before the interview, whereas Phase Two occurs when you sit down with HR, the hiring manager, or the recruiter and hash out the details.

Phase One

Start by looking at your own finances. Figure out your monthly and yearly budget. Decide what you need to earn to scrape by and what you need to be comfortable—whatever comfortable looks like for you. Don’t forget to include the cost of saving for emergencies and retirement. Once you have this information, start looking at pay-scale data for the position you are considering, both nationally and locally. Looking at both is important to get a baseline for what you can expect the company to offer, which may be different locally from the national average.

Now, put those numbers aside for a moment, and write a list of how wonderful you are. No, really—write a list of all your qualifications, professional accomplishments, and open source contributions. You don’t have to show it to anyone, but you should keep it close at hand. Now that you have all this in front of you, take a walk or whatever you do to relax, and decide, in your own mind, how much your knowledge and expertise are worth.

Think about what matters to you besides your direct monetary compensation.

Then think about what matters to you besides your direct monetary compensation. How much time off would you like? What would you like your work hours to be? Do you prefer to work in an office or remotely? What kind of sign-on bonus do you expect? Do you want to go back to school for an advanced degree? Would you like your employer to pay for it and allow flexibility in your schedule so you can attend classes?

There are a ton of fringe benefits to employment, and often we forget that many are negotiable. Once you know what you want, decide where you’re willing to bend; for example, you might be willing to accept a little less money to have extra holiday days or to work remotely. Once you know where you’re flexible, create a salary range. The low end is the rate that you absolutely will not go below, and the high end is what you prefer. Now make a table and in the first column write down regular intervals within that range. In the second column, do a little quick and dirty math to add 10% to each number. If you think they’ll offer between US$ 50,000 and 55,000, your table may look something like this:

Offer Offer +10%
$ 50,000 $ 55,000
$ 51,000 $ 56,100
$ 52,000 $ 57,200
$ 53,000 $ 53,800
$ 54,000 $ 59,400
$ 55,000 $ 60,500

Now that you’ve done your research and prep work, you’re ready to negotiate.

Phase Two

This is the day. The company you’ve been interviewing with for that job you’d love (or desperately need) has extended a job offer. Whether it comes by letter, phone call, email, or while sitting in a cold office across from a steely eyed negotiator, the result is the same: It’s time to step up to the plate and take your swing. Throughout the negotiations, make sure to stay polite, enthusiastic, and firm, use cooperative language, and if you’re offered an insulting number, don’t be afraid to walk away.

Don’t tell the recruiter your previous salary or salary expectations when they ask.

The hardest part comes first, but with practice it will become second nature. Don’t tell the recruiter your previous salary or salary expectations when they ask, and they will. Instead, give them a friendly smile and say something like, “I’m far more interested in designing widgets here at ACME Enterprises than I am in the compensation package.”

This gentle pushback does two things: First, it tells the other person that you know the game, and second, it keeps you from anchoring the negotiations against your previous pay. This should work most of the time. If the recruiter asks a second time, simply say, “I will consider any reasonable offer.” This is again putting the ball back in their court while not losing any ground. In rare cases, the company may push back and ask a third time. Don’t sweat it. Say something like, “You’re in a much better position to know how much I’m worth to your company than I am.” It’s hard to argue with that logic!

Try to negotiate in person or on the phone.

Once you get an offer, even if the company mails or emails it to you, try to negotiate in person or on the phone. I prefer to do it by phone, because I can be somewhere I feel comfortable and have notes in front of me, and I don’t have to police my facial expressions and body language. Even if the offer is more than you dreamed, repeat the number and stop talking. Jack Chapman, a career coach and author, calls this “the Flinch.” Because people are uncomfortable with silence, the person you are negotiating with is likely to try to fill the lull in the conversation, often with a better offer. Look at the table you made in Phase One, and counter their offer with one 10% higher.

Your last step is to ask for a compensation review in six months.

A little haggling between the numbers will probably follow. The person you’re negotiating with may need to speak to someone higher up and come back to you later in the day—this is all part of the process. Once you have a number that you both are happy with, cinch the deal and use that as a baseline to negotiate your fringe benefits. Maybe you’re willing to give up that 10% you negotiated to get extra holiday days, or a company car, or whatever is important to you. Your last step is to ask for a compensation review in six months. This gives you half a year to show them how great you are, then you can ask for more money in your glowing pay review.

Negotiating a job offer can feel a little overwhelming, but if you practice, do your research, and remain calm, enthusiastic, and firm, you’ll end up with both a more rewarding experience and a more satisfying pay stub.

What are your experiences with negotiation? Do you have a tip or trick that never fails? Tell me about it in the comments below.

How To Install PIP to Manage Python Packages in Linux

‘,
enableHover: false,
enableTracking: true,
buttons: { twitter: {via: ‘tecmint’}},
click: function(api, options){
api.simulateClick();
api.openPopup(‘twitter’);
}
});
jQuery(‘#facebook’).sharrre({
share: {
facebook: true
},
template: ‘{total}’,
enableHover: false,
enableTracking: true,
click: function(api, options){
api.simulateClick();
api.openPopup(‘facebook’);
}
});
jQuery(‘#googleplus’).sharrre({
share: {
googlePlus: true
},
template: ‘{total}’,
enableHover: false,
enableTracking: true,
urlCurl: ‘https://www.tecmint.com/wp-content/themes/tecmint/js/sharrre.php’,
click: function(api, options){
api.simulateClick();
api.openPopup(‘googlePlus’);
}
});
jQuery(‘#linkedin’).sharrre({
share: {
linkedin: true
},
template: ‘{total}’,
enableHover: false,
enableTracking: true,
buttons: {
linkedin: {
description: ‘How To Install PIP to Manage Python Packages in Linux’,media: ‘https://www.tecmint.com/wp-content/uploads/2017/08/Install-Python-PIP-in-Linux.png’ }
},
click: function(api, options){
api.simulateClick();
api.openPopup(‘linkedin’);
}
});
// Scrollable sharrre bar, contributed by Erik Frye. Awesome!
var shareContainer = jQuery(“.sharrre-container”),
header = jQuery(‘#header’),
postEntry = jQuery(‘.entry’),
$window = jQuery(window),
distanceFromTop = 20,
startSharePosition = shareContainer.offset(),
contentBottom = postEntry.offset().top + postEntry.outerHeight(),
topOfTemplate = header.offset().top;
getTopSpacing();
shareScroll = function(){
if($window.width() > 719){ var scrollTop = $window.scrollTop() + topOfTemplate,
stopLocation = contentBottom – (shareContainer.outerHeight() + topSpacing);
if(scrollTop > stopLocation){
shareContainer.offset({top: contentBottom – shareContainer.outerHeight(),left: startSharePosition.left});
}
else if(scrollTop >= postEntry.offset().top-topSpacing){
shareContainer.offset({top: scrollTop + topSpacing, left: startSharePosition.left});
}else if(scrollTop 1024)
topSpacing = distanceFromTop + jQuery(‘.nav-wrap’).outerHeight();
else
topSpacing = distanceFromTop;
}
});
]]>

How to Connect to MySQL Without Root Password on Terminal

‘,
enableHover: false,
enableTracking: true,
buttons: { twitter: {via: ‘tecmint’}},
click: function(api, options){
api.simulateClick();
api.openPopup(‘twitter’);
}
});
jQuery(‘#facebook’).sharrre({
share: {
facebook: true
},
template: ‘{total}’,
enableHover: false,
enableTracking: true,
click: function(api, options){
api.simulateClick();
api.openPopup(‘facebook’);
}
});
jQuery(‘#googleplus’).sharrre({
share: {
googlePlus: true
},
template: ‘{total}’,
enableHover: false,
enableTracking: true,
urlCurl: ‘https://www.tecmint.com/wp-content/themes/tecmint/js/sharrre.php’,
click: function(api, options){
api.simulateClick();
api.openPopup(‘googlePlus’);
}
});
jQuery(‘#linkedin’).sharrre({
share: {
linkedin: true
},
template: ‘{total}’,
enableHover: false,
enableTracking: true,
buttons: {
linkedin: {
description: ‘How to Connect to MySQL Without Root Password on Terminal’,media: ‘https://www.tecmint.com/wp-content/uploads/2017/08/MySQL-Passwordless-Root-Login.png’ }
},
click: function(api, options){
api.simulateClick();
api.openPopup(‘linkedin’);
}
});
// Scrollable sharrre bar, contributed by Erik Frye. Awesome!
var shareContainer = jQuery(“.sharrre-container”),
header = jQuery(‘#header’),
postEntry = jQuery(‘.entry’),
$window = jQuery(window),
distanceFromTop = 20,
startSharePosition = shareContainer.offset(),
contentBottom = postEntry.offset().top + postEntry.outerHeight(),
topOfTemplate = header.offset().top;
getTopSpacing();
shareScroll = function(){
if($window.width() > 719){ var scrollTop = $window.scrollTop() + topOfTemplate,
stopLocation = contentBottom – (shareContainer.outerHeight() + topSpacing);
if(scrollTop > stopLocation){
shareContainer.offset({top: contentBottom – shareContainer.outerHeight(),left: startSharePosition.left});
}
else if(scrollTop >= postEntry.offset().top-topSpacing){
shareContainer.offset({top: scrollTop + topSpacing, left: startSharePosition.left});
}else if(scrollTop 1024)
topSpacing = distanceFromTop + jQuery(‘.nav-wrap’).outerHeight();
else
topSpacing = distanceFromTop;
}
});
]]>

Top 5: 13 years of OpenStreetMap, Linux-powered guitar amps, and more

In this week’s top 5, we take a look at maps, robots, and more!

This week’s top articles

5. 6 hardware projects for upgrading your home

When you make your house a little smarter, you’re going to want to use open hardware. Editor Alex Sanchez shares some projects that you can do yourself on your old house.

4. 7 open source Twitter bots to follow

Do you like Twitter, but wish it wasn’t so full of humans? Editor Jason Baker shares some bots you might want to follow or use as inspiration to make your own.

3. How to make a low-cost guitar amp with Linux

Are you having trouble getting your music to go to 11? Seth Kenlon shows you how to turn your computer into a rock and roll machine.

2. Make your own Twitter bot with Python and Raspberry Pi

Community moderator Ben Nuttall shares how you can use a Raspberry Pi and the twython library to write your own Twitter bot. Now you can remind your friends to take out their trash cans every week.

1. 13 amazing maps to celebrate 13 years of OpenStreetMap

Editor Jason Baker shares how this community mapping project has done a lot over the years. And the best part is that no one will yell at you to roll the maps.

How to Install PHP 5.4, PHP 5.5 or PHP 5.6 on CentOS 6

‘,
enableHover: false,
enableTracking: true,
buttons: { twitter: {via: ‘tecmint’}},
click: function(api, options){
api.simulateClick();
api.openPopup(‘twitter’);
}
});
jQuery(‘#facebook’).sharrre({
share: {
facebook: true
},
template: ‘{total}’,
enableHover: false,
enableTracking: true,
click: function(api, options){
api.simulateClick();
api.openPopup(‘facebook’);
}
});
jQuery(‘#googleplus’).sharrre({
share: {
googlePlus: true
},
template: ‘{total}’,
enableHover: false,
enableTracking: true,
urlCurl: ‘https://www.tecmint.com/wp-content/themes/tecmint/js/sharrre.php’,
click: function(api, options){
api.simulateClick();
api.openPopup(‘googlePlus’);
}
});
jQuery(‘#linkedin’).sharrre({
share: {
linkedin: true
},
template: ‘{total}’,
enableHover: false,
enableTracking: true,
buttons: {
linkedin: {
description: ‘How to Install PHP 5.4, PHP 5.5 or PHP 5.6 on CentOS 6’,media: ‘https://www.tecmint.com/wp-content/uploads/2017/08/Install-PHP-5-4-and-5-6-in-CentOS-6.png’ }
},
click: function(api, options){
api.simulateClick();
api.openPopup(‘linkedin’);
}
});
// Scrollable sharrre bar, contributed by Erik Frye. Awesome!
var shareContainer = jQuery(“.sharrre-container”),
header = jQuery(‘#header’),
postEntry = jQuery(‘.entry’),
$window = jQuery(window),
distanceFromTop = 20,
startSharePosition = shareContainer.offset(),
contentBottom = postEntry.offset().top + postEntry.outerHeight(),
topOfTemplate = header.offset().top;
getTopSpacing();
shareScroll = function(){
if($window.width() > 719){ var scrollTop = $window.scrollTop() + topOfTemplate,
stopLocation = contentBottom – (shareContainer.outerHeight() + topSpacing);
if(scrollTop > stopLocation){
shareContainer.offset({top: contentBottom – shareContainer.outerHeight(),left: startSharePosition.left});
}
else if(scrollTop >= postEntry.offset().top-topSpacing){
shareContainer.offset({top: scrollTop + topSpacing, left: startSharePosition.left});
}else if(scrollTop 1024)
topSpacing = distanceFromTop + jQuery(‘.nav-wrap’).outerHeight();
else
topSpacing = distanceFromTop;
}
});
]]>

How to Install PostgreSQL 10 on CentOS/RHEL and Fedora

PostgreSQL is a powerful, highly scalable, open source and cross-platform object-relational database system that runs on Unix-like operating systems including Linux and Windows OS. It is an enterprise level database system which is highly reliable and offers data integrity and correctness to users.

In this article, we will explain how to install latest version of PostgreSQL 10 on CentOS, RHEL, Oracle Enterprise Linux, Scientific Linux and Fedora using official PostgreSQL Yum repository.

Add PostgreSQL Yum Repository

This official PostgreSQL Yum repository will combine with your Linux system and offers automatic updates for all supported versions of PostgreSQL on RedHat based distributions such as CentOS, Scientific Linux and Scientific Linux, as well as current versions of Fedora.

Note that due to the shorter Fedora support cycle, not all versions are available and we suggest that do not use Fedora for server deployments.


To use the yum repository, follow these steps:

--------------- On RHEL/CentOS 7 and Scientific Linux/Oracle Linux 7 --------------- # yum install https://download.postgresql.org/pub/repos/yum/10/redhat/rhel-7-x86_64/pgdg-redhat10-10-1.noarch.rpm
--------------- On 64-Bit RHEL/CentOS 6 and Scientific Linux/Oracle Linux 6 --------------- # yum install https://download.postgresql.org/pub/repos/yum/10/redhat/rhel-6-x86_64/pgdg-redhat10-10-1.noarch.rpm
--------------- On 32-Bit RHEL/CentOS 6 and Scientific Linux/Oracle Linux 6 --------------- # yum install https://download.postgresql.org/pub/repos/yum/10/redhat/rhel-6-i386/pgdg-redhat10-10-1.noarch.rpm
--------------- On Fedora 26 --------------- # dnf install https://download.postgresql.org/pub/repos/yum/10/fedora/fedora-26-x86_64/pgdg-fedora10-10-2.noarch.rpm
--------------- On Fedora 25 --------------- # dnf install https://download.postgresql.org/pub/repos/yum/10/fedora/fedora-25-x86_64/pgdg-fedora10-10-3.noarch.rpm
--------------- On Fedora 24 --------------- # dnf install https://download.postgresql.org/pub/repos/yum/10/fedora/fedora-24-x86_64/pgdg-fedora10-10-3.noarch.rpm
Enable PostgreSQL Yum Repository

Enable PostgreSQL Yum Repository

Install PostgreSQL Server

After adding PostgreSQL yum repository in your respective Linux distribution, use the following command to install PostgreSQL server and client packages.

# yum install postgresql10-server postgresql10 [On RedHat based Distributions]
# dnf install postgresql10-server postgresql10 [On Fedora Linux]
Install PostgreSQL Server

Install PostgreSQL Server

Important: PostgreSQL data directory /var/lib/pgsql/10/data/ contains all of the data files for the database.

Initialize PostgreSQL Database

Due to some policies for Red Hat based distributions, the PostgreSQL installation will not be active for automatic start or have the database initialized automatically. To complete your database installation, you need to initialize your database before using it for first time.

# /usr/pgsql-10/bin/postgresql-10-setup initdb
Initialize PostgreSQL Database

Initialize PostgreSQL Database

Start and Enable PostgreSQL Server

After database initialize completes, start PostgreSQL service and enable PostgreSQL service to auto start on system boot.

--------------- On SystemD --------------- # systemctl start postgresql-10
# systemctl enable postgresql-10
# systemctl status postgresql-10 --------------- On SysVinit --------------- # service postgresql-10 start
# chkconfig postgresql-10 on
# service postgresql-10 status
Start PostgreSQL Server

Start PostgreSQL Server

Verify PostgreSQL Installation

After installing PostgreSQL 10 on your server, verify its installation by connecting to postgres database server.

# su - postgres
$ psql
psql (10.0)
Type "help" for help.

If you want you can create a password for user postgres for security purpose.

postgres=# \password postgres
Set PostgreSQL User Password

Set PostgreSQL User Password

You can find more information at the PostgreSQL Homepage: https://www.postgresql.org/

Also check out these articles about popular database management systems:

  1. How to Install and Secure MariaDB 10 in CentOS 7
  2. How to Install and Secure MariaDB 10 in CentOS 6
  3. Install MongoDB Community Edition 3.2 on Linux Systems

That’s all! Hope you find this article useful. If you have any questions or thoughts to share, use the comment section below.

How to create a blog with AsciiDoc

I work daily with content management tools and support documentation writers whose preferred markup language is AsciiDoc. It has a simple syntax, but enough features to keep even a hardcore documentation nerd happy. AsciiDoc allows you to write documentation in a more natural way and mark it up cleanly for presentation on the web or as a PDF. This got me thinking, “Wouldn’t it be handy to be able to maintain a website purely with AsciiDoc?”

After some googling and chatting with colleagues, I found Hugo, a publishing platform that can transform articles written in Markdown or AsciiDoc into usable content for the web. It is a very feature-rich platform, with a rich language for working with templates and theming, and it’s a lot of fun to work with.

One big advantage to me is that Hugo doesn’t require a database to support a blog site with plenty of functionality. The pages are rendered in HTML, so sites are blazingly fast and very easy to maintain. It even comes with its own server, so I can test my site while I work on it. As long as your server can deliver HTML, you’re good to go.

The lack of a database or need for a language such as PHP reduce the risk of SQL injection, making it especially handy for creating secure sites. It also makes a website faster than one on a traditional platform, and combining it with a content-delivery network (CDN) produces a very fast website.

It supports tasks that normally are driven by a blogging platform; for example, it can automatically populate an RSS feed when a new article is added. Everyone on your team can run a copy of the site locally, so they can work on their articles in a draft state and refrain from publishing them until they’re ready. If you combine it with a Git branching strategy, multiple authors can work on blogs and articles, then book them back into your main branch when ready to publish. Other interactive elements, such as comments, can be added with Disqus.

A different kind of development platform

When I develop a blog, I start with the idea of “content first” and try not to get tied up with the platform. This is a fine idea, but, in reality, I constantly tweak the site. Then I tweak it a little more, then a weekend is gone, and I haven’t written any content. I spent all my time playing with the theme or working on back-end services.

Using the Hugo platform with the AsciiDoc markup language and AsciiDoctor, a digital Swiss Army knife for AsciiDoc, helps me focus on content and structure rather than presentation. Hugo has a decent template system, so I can do a lot more with a lot less code. AsciiDoc helps me write documents with a nice structure, and Hugo uses AsciiDoctor to convert the documents into other formats, such as PDF or Linux man pages, as I write them. Because I can preview them locally as HTML, I can identify places my content needs work. By running Hugo in a console, I can see issues with my document whenever I save it, so I can fix them and move on. This is different from my usual routine:

“My blog post is done! And now to send my masterpiece to the world! …? Wait a minute, why is all my text a H1? I hate myself.”
                     —Me, at 3 a.m. on very little sleep and too much coffee

Documentation workflow

I normally write my first drafts in plain English. I use a new branch in Git for each article, which keeps things nice and simple until I am ready to publish. Once I give my article a couple of edits to make sure everything flows well, I add AsciiDoc markup so Hugo can format the article as clean HTML. When the article is ready to publish, I merge it back into my master branch.

Often I work on documents that include standardized text or content (e.g., information about licensing, support, or company descriptions). I use an include statement for that boilerplate content and set it up in my template or define content types to add it, depending on what I’m working on. This method makes standard, repetitive content more modular and easier to maintain.

You can also define metadata that your theme can use to organize content, e.g., tagging articles, grouping content, defining a page as a “solution” or a “FAQ,” etc. This is especially handy with AsciiDoc, as a document’s header will have a standard metadata section, which may be different between an article and a blog post. I can define the metadata within Hugo, and it does the work for me when I create a new piece of content.

My preferred editor, Vim, has syntax files available for AsciiDoc. If you are looking for a more visual approach to working with content, I recommend the Atom editor with the AsciiDoc Preview plugin. It provides a real-time preview of your page, making it easy to check your document. Atom was created by GitHub and has built-in support for working with Git, so it’s straightforward to work on documents across different branches.

Overall, I am very happy with Hugo and AsciiDoc. My process is more content-focused. I have a great workflow with Git, and site performance is noticeably better versus a traditional PHP/MySQL content management system.

Getting started

If you are interested in getting started with Hugo and AsciiDoc, my demo on GitHub provides content, a theme, and notes on how to get up and running. The README also contains step-by-step instructions on downloading and configuring Hugo and writing with AsciiDoc, as well as links to resources to help you get started.

Have you used AsciiDoc and Hugo? Please post links to your projects in the comments.

How to Run PHP Script as Normal User with Cron

Cron is a powerful utility for time-based scheduling of jobs in Unix-like operating systems including Linux. It runs as a daemon and can be used to schedule jobs such as commands or shell scripts to perform backups, schedule updates plus many more, that run periodically and automatically in the background at specific times, dates, or intervals.

One limitation of cron is that it assumes a system will run forever; so it is suitable for servers other than desktops machines. Additionally, you can schedule a task on given or later time, using the ‘at’ or ‘batch’ commands: but the task is only run once (it’s not repeated).

Suggested Read: How to Schedule Jobs Using Anacron on Linux

In this article, we will explain how to allow a normal system user to run or execute a PHP script via a cron job scheduler in Linux.

You can schedule jobs using crontab (CRON TABle) program. Each user can have their own crontab file which is made up of six fields for defining a job:

  • Minute – accepts values between 0-59.
  • Hour – accepts values between 0-23.
  • Day of Month – stores values between 1-31.
  • Month of the year – stores values between 1-12 or Jan-Dec, you can use first three letters of each month’s name i.e Jan or Jun.
  • Day of week – holds values between 0-6 or Sun-Sat, Here also you can use first three letters of each day’s name i.e Sun or Wed.
  • Command – command to be executed.


To create or edit entries in your own crontab file, type:

$ crontab -e

And to view all your crontab entries, type this command (which will simply print the crontab file to std output):

$ crontab -l

However, if you are a system administrator and want to execute a PHP script as another user, you need to schedule it in the /etc/crontab file or root user’s crontab file which support an extra filed for specifying the username:

$ sudo vi /etc/crontab

And schedule your PHP script to be executed like this, specify the username after the timing section.

0 0 * * * tecmint /usr/bin/php -f /var/www/test_site/cronjobs/backup.php

The above entry executes the script /var/www/test_site/cronjobs/backup.php everyday at midnight as user tecmint.

If you want to execute above script automatically every ten minutes, then add the following entry to crontab file.

*/10 * * * * tecmint /usr/bin/php -f /var/www/test_site/cronjobs/backup.php

In the above example, the */10 * * * * represents when the job should happen. The first figure shows minutes – in this scenario, on every "ten" minute. The other figures show, respectively, hour, day, month and day of the week.

You may also like to read these following related articles.

  1. Using Shell Scripting to Automate Linux System Maintenance Tasks
  2. 12 Useful PHP Commandline Usage Every Linux User Must Know
  3. How to Run PHP Codes in Linux Terminal
  4. 30 Useful Linux Commands for System Administrators

That’s all! We hope you find this article useful. If you have any questions or extra ideas to share concerning this topic, use the comment form below.

How to Test PHP MySQL Database Connection Using Script

‘,
enableHover: false,
enableTracking: true,
buttons: { twitter: {via: ‘tecmint’}},
click: function(api, options){
api.simulateClick();
api.openPopup(‘twitter’);
}
});
jQuery(‘#facebook’).sharrre({
share: {
facebook: true
},
template: ‘{total}’,
enableHover: false,
enableTracking: true,
click: function(api, options){
api.simulateClick();
api.openPopup(‘facebook’);
}
});
jQuery(‘#googleplus’).sharrre({
share: {
googlePlus: true
},
template: ‘{total}’,
enableHover: false,
enableTracking: true,
urlCurl: ‘https://www.tecmint.com/wp-content/themes/tecmint/js/sharrre.php’,
click: function(api, options){
api.simulateClick();
api.openPopup(‘googlePlus’);
}
});
jQuery(‘#linkedin’).sharrre({
share: {
linkedin: true
},
template: ‘{total}’,
enableHover: false,
enableTracking: true,
buttons: {
linkedin: {
description: ‘How to Test PHP MySQL Database Connection Using Script’,media: ‘https://www.tecmint.com/wp-content/uploads/2017/08/Test-PHP-MySQL-Database-Connection.png’ }
},
click: function(api, options){
api.simulateClick();
api.openPopup(‘linkedin’);
}
});
// Scrollable sharrre bar, contributed by Erik Frye. Awesome!
var shareContainer = jQuery(“.sharrre-container”),
header = jQuery(‘#header’),
postEntry = jQuery(‘.entry’),
$window = jQuery(window),
distanceFromTop = 20,
startSharePosition = shareContainer.offset(),
contentBottom = postEntry.offset().top + postEntry.outerHeight(),
topOfTemplate = header.offset().top;
getTopSpacing();
shareScroll = function(){
if($window.width() > 719){ var scrollTop = $window.scrollTop() + topOfTemplate,
stopLocation = contentBottom – (shareContainer.outerHeight() + topSpacing);
if(scrollTop > stopLocation){
shareContainer.offset({top: contentBottom – shareContainer.outerHeight(),left: startSharePosition.left});
}
else if(scrollTop >= postEntry.offset().top-topSpacing){
shareContainer.offset({top: scrollTop + topSpacing, left: startSharePosition.left});
}else if(scrollTop 1024)
topSpacing = distanceFromTop + jQuery(‘.nav-wrap’).outerHeight();
else
topSpacing = distanceFromTop;
}
});
]]>

How to Redirect HTTP to HTTPS on Apache

HTTP (Hyper Text Transfer Protocol) is a popular as well as the fundamental protocol for data communication on the World Wide Web (WWW); typically between a web browser and the server which stores web files. Whereas HTTPS is the secure version of HTTP, where the ‘S‘ at the end stands for ‘Secure‘.

Using HTTPS, all data between your browser and the web server are encrypted thus secure. This tutorial will show you how to redirect HTTP to HTTPS on Apache HTTP server in Linux.

Before you can set up an Apache HTTP to HTTPS redirect for your domain, make sure you have SSL certificate installed and mod_rewrite is enabled in Apache. For more information on how to setup SSL on Apache, see following guides.

  1. How to Create Self-Signed SSL Certificates and Keys for Apache
  2. How to Install Let’s Encrypt SSL Certificate on CentOS/RHEL 7
  3. How to Install Let’s Encrypt SSL Certificate on Debian/Ubuntu

Redirect HTTP to HTTPS on Apache Using .htaccess File

For this method, make sure mod_rewrite is enabled, otherwise enable it like this on Ubuntu/Debian systems.

$ sudo a2enmod rewrite [Ubuntu/Debian]


For CentOS/RHEL users, ensure that your have the following line in httpd.conf (mod_rewrite support – enabled by default).

LoadModule rewrite_module modules/mod_rewrite.so

Now you just need to edit or create .htaccess file in your domain root directory and add these lines to redirect http to https.

RewriteEngine On RewriteCond %{HTTPS} !=on RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L] 

Now, when a visitor types http://www.yourdomain.com the server will automatically redirect HTTP to HTTPS https://www.yourdomain.com.

Redirect HTTP to HTTPS on Apache Virtual Host

Additionally, to force all web traffic to use HTTPS, you can also configure your virtual host file. Normally, there are two important sections of a virtual host configurations if an SSL certificate is enabled; the first contains configurations for the non-secure port 80.

The second is for the secure port 443. To redirect HTTP to HTTPS for all the pages of your website, first open the appropriate virtual host file. Then modify it by adding the configuration below.

NameVirtualHost *:80
<VirtualHost *:80>
ServerName www.yourdomain.com
Redirect / https://www.yourdomain.com
</VirtualHost>
<VirtualHost _default_:443>
ServerName www.yourdomain.com
DocumentRoot /usr/local/apache2/htdocs
SSLEngine On
# etc...
</VirtualHost>

Save and close the file, then restart the HTTP sever like this.

$ sudo systemctl restart apache2 [Ubuntu/Debian]
$ sudo systemctl restart httpd [RHEL/CentOS]

While the <VirtualHost> is the most recommended solution because it is simpler and safer.

You may like to read these useful assortment of Apache HTTP server security hardening articles:

  1. 25 Useful Apache ‘.htaccess’ Tricks to Secure and Customize Websites
  2. How to Password Protect Web Directories in Apache Using .htaccess File
  3. How to Hide Apache Version Number and Other Sensitive Info
  4. Protect Apache Against Brute Force or DDoS Attacks Using Mod_Security and Mod_evasive

That’s all! To share any thoughts concerning this guide, make use of the feedback form below. And remember to always stay connected to Tecmint.com.