Setting Up Scheduled Sending Using Cron

Cron jobs are schedule based services that run on just about every UNIX and Linux server. A cron job allows you to run commands and scripts on a recurring schedule at certain times and dates that you can set in a “crontab”. It can be set to run any PHP script or any command that can be run from a command line.

By the end of this tutorial, you will be able to:

  1. Understand how to use the crontab command and command line.
  2. Set up cron jobs on your server via SSH, cPanel, or Plesk.
  3. Set up cron jobs on Windows server.

Getting Started

To get started with setting up cron, you must make sure that your server is currently running cron. Your hosting provider will also be able to tell you where and how you can set up cron jobs — whether it’s from a web based control panel, or through a terminal window.

Crontab Command

Cron tables, or often called crontabs are files that contain a list of commands to be executed on a specified schedule. Here’s an example of a crontab entry:

Example Cron Entry
To visually explain the different parts of this crontab, each “section” has been color coded:
Cron Color Coded
  • Red: Minute of the hour – Set to a number between 0-59 for the corresponding minute of the hour or * for every minute.
  • Orange: Hour of the day – Set to a number between 0-23 for the corresponding hour of the day or * for every hour.
  • Yellow: Day of the month – Set to number between 1-31 for the corresponding day of the month or * for every day.
  • Light Green: Month of the year – Set to a number between 1-12 for the corresponding month of the year or * for every month You can use the name of the month of the year as well. Eg. march or March 
  • Dark Green: Day of the week – Set to a number between 0-7 for the corresponding day of the week (0 or 7 is Sunday) You can use the name of the day of the week as well. Eg. tuesday or Tuesday
  • Cyan: Beginning of the command line – Here, you specify the path to PHP and any flags you might need.
  • Blue: The path to your script – Specify the path to the script that you want to run.


The asterisks allow you to specify the frequency with which the script should be run on. For example, if you want to set a cron to run every 4:00 am, then you should place 0 in the “minute” column, 4 in the “hour” column, and asterisks in the other scheduling columns. 

You can also set a range of values in the cron command so that it will run within that range. Eg. 2-5 will run 2, 3, 4 and 5 of the column you set it in. 

If you wanted to run a cron job every 5 minutes, instead of specifying a list like 0,5,10…,55, you can use the abbreviated syntax */5 in the “minute” column. Many would confuse this */5 as a fraction, but it is actually setting the frequency that the cron takes place in that column. It means “every five” rather than a fifth of it.


0 * * * *
Cron will run when the minutes are at 0, meaning every hour.
0 4 * * *
Cron will always run at 4:00 am.
0 * 2-5 * *
Cron will run every hour on the 2nd, 3rd, 4th, and 5th of the month. 
*/5 * * * *
Cron will run every 5 minutes.
0  */5 * * *
Cron will run every 5 hours on the hour.
30 7 1 * *
Cron will always run on the 1st day of every month at 7:30 am.
0 9 14 2 * 


0 9 14 february *
Cron will always run every February 14 at 9:00 am.

Command Line

The cyan and blue sections are the command line section where you specify the command and arguments to be executed. In this case, you will be using the command line to run the Interspire Email Marketer meta scheduling script. 

Find the following necessary information to add on your command line:

  • Path to PHP – The application will attempt to read this from your server information. If you do not see a path to PHP in your command then you will have to contact your hosting provider to determine what it is. Some alternate way to determine the location of your PHP executable could be to issue “which php” from the command line.
  • Flags – In this example, the -f flag is used  to specify the PHP file you want to run. You can also add > /dev/null after the command to redirect the output.
  • Server Path to your script – You will need to specify the full server path directly to your script usually as displayed in the /Settings/Cron Settings page. If the fields to configure cron are hidden in Interspire Email Marketer, you have to select “Yes, I want to enable cron support” to proceed with the configuration.

Note: Interspire Email Marketer attempts to determine the path to PHP, any flags needed, as well as the path to the IEM cron file. If they are not displayed, your server might have prohibited Interspire Email Marketer from locating this for you. You can either try to determine the paths manually by examining the file system or ask your hosting provider to tell you what it is. 

IEM Cron Settings

Setting Up Cron

After understanding the crontab command and the different parts of the command line, you can begin setting up a cron job. For the Interspire Email Marketing system, you need to run the ~/admin/cron/cron.php file to make use of scheduled emails, autoresponders, automatic bounce handling, and other functions. 

Setting Up Cron Using SSH

  1. Login to your web server via SSH.
  2. Login to the Interspire Email Marketer control panel, go to the Settings page.
  3. Make sure to tick the “Yes, Cron support is enabled” option.
  4. Copy the “Cron Command to Run” from the Interspire Email Marketer into your clipboard from the Settings/Cron Settings page.
  5. Save your changes. 
  6. Type “crontab -e” to edit your crontab file. This will load your crontab into a text editor. The default text editor for Linux is usually vi, the following instructions will relate to it.
  7. Press “i” to change the insert mode and specify the date and time you wish the cron job to run. For reference, please go to the “Crontab Command” section of this article. 
  8. Put a space after the last “*” and then paste the command to run by pressing Shift+Insert on your keyboard. This will paste the “Cron Command to Run” that you copied into your clipboard earlier.
  9. Press the following key sequence to save your crontab: escape (back to command mode), colon, w (write/save), q (quit), enter
  10. You can verify your crontab by typing crontab -|

Many hosting providers offer a GUI interface such as cPanel or Plesk to manage server administration tasks. Let’s see how to set up cron jobs in cPanel and Plesk.

Setting Up Cron Using cPanel

  1. Login to your control panel and look for the Cron jobs icon in the advanced section.
  2. Select the frequency of the cron job you wish to run from the Common Settings drop-down, or enter the needed values in the text boxes.
  3. Copy the “Cron Command to Run” from the Interspire Email Marketer /Settings/Cron Settings page.
  4. In the “Command” text box, add the path to PHP and the full path to your script.
  5. Click “Add New Cron Job”.

Refer to the cPanel Documentation for more details.

Setting Up Cron Using Plesk

  1. Login to your Plesk control panel and look for the cron jobs icon. Cron jobs are called “Scheduled Tasks” in Plesk. 
  2. Navigate to the domain of interest if your Plesk installation has more than one domain. You can also navigate to Tools & Settings then…
  3. Go to Scheduled Tasks/Add Task to create a cron job or task.
  4. For the task type you can either choose “Run a command” or “Run a PHP script”. 
  5. Copy the “Cron Command to Run” from the Interspire Email Marketer /Settings/Cron Settings page and enter it on the text box provided.
  6. If you choose “Run a PHP script” you only need to paste the command copied above. Select the correct version of PHP to execute the script. Refer to the server requirements of the version of Interspire you are running to confirm which PHP version it is compatible with. If you choose “Run a command” you will also need to specify the location of the PHP interpreter to use.
  7. Select the frequency or set the desired date and time of the cron job you wish to run. 
  8. Click “Run Now” to verify. Then “OK” to save your new schedule task settings.

Refer to the Plesk Documentation for more details.

Setting Up Cron On Windows Server

If you are using a Windows web server, you must use Scheduled Tasks which is Windows mechanism to scheduling tasks. If you are not running your web server locally, you may have to consult your web host to set it up for you.

  1. Search for Task Scheduler from the Start menu and open the application.
  2. Select the “Create Task” from the “Actions” panel.
  3. Once the “Create Task” window appears, enter the name of the cron job or task under the “General” tab.
  4. Select the “Triggers” tab, click the “New” button and configure the date and time you wish your cron job to run. Press “OK” when done. 
  5. Copy the “Cron Command to Run” from the Interspire Email Marketer into your clipboard from the /Settings/Cron Settings page.
  6. Make sure to tick the “Yes, Cron support is enabled” option and save your changes. 
  7. Go to the “Actions” tab, click the “New” button and add the script under the “Program/script” field. Press “OK” when done.
  8. Press another “OK” button to be redirected to the “Task Scheduler” window.
  9. Select and double click the cron job you have created.
  10. Click the “Run” option from the “Selected Item” panel.

Running The Scheduling Script Regularly

You can run the scheduling script as often as you like. The more frequently you run the script, the more precision you can have with your tasks.  You should run it at least as often as the most scheduled activity in the control panel. The settings inside the application’s control panel control how often a particular task is run. For example, you can run the scheduling script every 1 minute, then use the /Settings/Cron Settings in the control panel to only run autoresponders every 15 minutes. This allows you to control everything from inside the application without having to edit the crontab on your server.

Get a headstart

Experience Success with Interspire Email Marketer