SiteHost

Cron Jobs

Cron is a tool that schedules commands or shell scripts to run automatically at a particular time interval. For example, you may want to perform some maintenance by running a script every night at midnight.

Adding a Cron Job

  • Once you are logged into the Control Panel click Websites in the left menu.
  • Click on the website you want to add the Cron Job to.
  • Click on Cron Jobs in the tab menu, and then click Add Cron Job
  • Choose the frequency of how often the command will be run, the command to run, and the output options.
    • The frequency can be selected from the drop-down list, or clicking the Show Advanced button gives access to the minute/hour/day/month/day of week fields that will be passed to cron.
    • Command specifies the command you wish the cron job to execute. An example of this might be: /usr/bin/php -f /home/www/mysitehostaccount/website.example.com/file.php
    • The output options 2>&1>, > and >> are the standard Unix redirection operators, and mean the following:
      • 2>&1> – All output will be stored to the file.
      • > – All standard output will be stored to the file.
      • >> – All standard output will be appended to the file.
  • Click Add Cron Job.

Removing a Cron Job

  • Once you are logged into the Control Panel click Websites in the left menu.
  • Click on the website you want to remove the Cron Job from.
  • Click on the Cron Jobs tab.
  • Click the More Actions icon (᛫᛫᛫) on the right of the Cron Job you want to delete.
  • Click Delete to confirm and apply.