Setting up a cron job generator

A cron job is a process that is automatically run at whatever time you set it to run. This can be each day, each hour of every day, every 5 minutes of every hour of every day.

Setting up a cron job can be a daunting task if you don't know what you're doing. It appears to be a lot harder than what it actually is. Hopefully, with the use of our generator and tips on how to get your cron job running, you will be able to set up a cron job quite easy.

  • Determine how often you would like this process to run - which minute of which hour of which days
  • Hold down the (ctrl) key to choose multiple values in the one select box
  • Choose the times/days/months you would like to run the process. The checkbox below the hours/day selection allows you to set whether you would like to run the process regularly, for instance, choose '5' and check the checkbox underneath to choose every 5 minutes.
  • If you want the process to run every day, don't choose anything from the 'day' list. It is the same for months - day of week - hours. A non-selection from a list will assume * all *
Cron details
Minute

Choose at which minute you would like the cron job to run. You can choose multiple minutes, or set to run every nth minute.
'0' is the minute on the hour, i.e.: 2.00pm. '1' is the first minute, i.e.: 2.01pm. NOTE: if you do not choose a minute here the cron will run EVERY MINUTE!


Hour

Choose at which hour you would like the cron job to run. You can choose multiple hours, or set to run every nth hour.
'0' is midnight, i.e.: 12 am. '12' is noon, i.e.: 12 pm. '22' is 10 pm


Day

Choose whether you want the cron to run every day, more than one selected day, every n days or the nth day. For example, if you choose '4th', the cron job will run at the set minute/hour but only on the 4th of the month. If you choose '4th' then tick to run every 4 days then the cron job will run every 4 days starting with the 4th. Or, you can choose multiple days in the list and the cron job will only run on the selected days.
As well as choosing a value here, you can choose a day of the week in the field further down and it will run on both that day and the days you select here.


Month

Choose whether you want the cron to run every month, every n months or the nth month. For example, if you choose 'February', the cron job will run at the set minute/hour/day but only in February. If you choose 'February' then tick to run every 2 months (as February is the 2nd month) then the cron job will run February, April, June, August, October, and December. Or, you can choose multiple months in the list and the cron job will only run in the selected months.


Day of Week
Choose which day/s of the week you want the cron job to run. This setting is useful if you want to run a cron job every Monday, instead of choosing the day of the month to run the job. This setting isn't needed if you have chosen the day of the month, as the job will then run on that date regardless of what day it falls on.

Or, leave this as 'every day' and set the day of the week further down.
Command details
Command to be executed:
Enter the command which you want to run. This can either be a path to a script, or a 'special' command. If you're not sure of the server path to a file/script, SSH or telnet into your server and navigate to the directory where the file is. Type 'pwd' at the command line, this will tell you the server path to the directory where the script is. Add the file name to the end of this, and that's what you use above.
You may need to enter the path to the interpreter before the path to the script, such as 'php' or '/usr/local/bin/php'.

Examples of commands for this field:
/home/myaccount/backup.cgi
perl /home/myaccount/backup.cgi
php /home/myaccount/clean_database.php
/home/myaccount/clean_database.php
/home/myaccount/monitor.sh
touch /tmp/file.lock
cp -Rfpud /home/myaccount /backup/myaccount/
Send results to:

Even though you may set the output of the cron job to write to a file (or /dev/null) the errors will be written to stderr. To enable the cron job to write silently, set the errors to write to stdout, which is written to the stipulated log.
Share the Setting up a cron job generator on Facebook