A Web.com Partner
Sign Up / Log In
Online Support Web Hosting

How to run a cron job

Cron is a software utility in Unix-like computer operating systems, which works as a time-based job scheduler. It can automate a command to run at fixed times, dates, or intervals.

A cron job is a command or script that is typically created and run to set up software environments or automate system maintenance and administration. For example, you could set a cron job to delete temporary files every week to free up disk space.

Creating a Cron Job

Here's how to create a cron job:

  1. Click Sign Up / Log In at the top of this page.
  2. Select Hosting Manager from the drop-down menu.
  3. Enter your username and password and click Log In.
  4. On the Home page, click on the Advanced icon or [ v ] arrow symbol on the right side, then click on the Cron Jobs button.
  5. Under Add New Cron Job, select Common Settings from the drop-down list.
  6. Set the following details to schedule your command:
  7. Minute
    Enter a number from 0-59. Select Common Settings
    Enter a number from 0-23. Select Common Settings
    Enter a number from 1-31. Select Common Settings
    Enter a number from 1-12 or the first three letters of the month, example, Jan. Select Common Settings
    Enter a number from 0-7 or the first three letters of the weekday, example, Mon. Select Common Settings

  8. Under Command, specify the command to run then click Add New Cron Job.

Congratulations! You just successfully created a cron job.

Understanding the Command to Run

The command contains two parts:

[program to execute (php/pyth./perl)] [switches] [script]

The program to run will specify the type of script you are running and will either be:

  • PHP
  • Python
  • Perl/CGI Scripts (This should be in your cgi-bin with permission 0755)

The script will need to be set on its direct path where it is located on our server, for example:

    /home/username/public_html/path/to/script, with “username” being your actual username.

Run a PHP script:

php -q /home/username/public_html/scripts/testrun.php

Run a Python script:

python /home/username/public_html/path/to/script

Run a Perl/CGI script:


Understanding the User Agent String

Below is the command to set the user agent:

curl –user-agent YOUR_STRING (URL)

lynx –dump –useragent=YOUR_STRING (URL)

Congratulations! You just successfully run a cron job.

Was this helpful? Yes No 65% of people found this helpful.