This Season
 

How to Use Cron

How to Use Cronthumbnail
Use Cron

Cron is a scheduling program used in all Linux and Unix operating systems. Linux and Unix users tell cron to run a job periodically such as every minute, every hour, or even just once a year. These jobs are often nicknamed "cronjobs." Cron is not intended for jobs that run only once. In just a few steps, you can schedule a regular job through cron.

Related Searches:
    Difficulty:
    Moderately Challenging

    Instructions

    Things You'll Need

    • Proficiency with the Linux or Unix command line
    • Proficiency with a Linux or Unix text editor
      • 1

        Log into the Linux or Unix system with your username and password.

      • 2

        Once inside Linux or Unix, click on the icon that brings up a command line window. In most Linux and Unix GUIs, the icon to click is the one that looks like a computer terminal.

      • 3

        Type "crontab -e" to load your crontab file into the editor. The crontab file is used to configure your jobs to be loaded into cron. The crontab command is used to ensure that there is only one text editor working on your crontab file at any moment.

      • 4

        Put in the first job you want to run in this file. The file has six fields separated by spaces or tabs that look like this: "59 16 5 * 1-5 /path/to/job."

        The first field and second fields are for the minute and hour of the day respectively. The third and fourth fields are for the day of month and month respectively. The fifth field is for the day of week where 0 is for Sunday, 1 is for Monday, and so on until 6 is for Saturday. The sixth field is the path and name of the program you want to run.

        If any of the first five fields has an asterisk, that tells cron to run the program as frequently as possible for that field. In the example above, the fourth field (month) has an asterisk, which means run the job every month instead of a specific month.

        The example above runs a program called /path/to/job on the 5th of every month at 16:59, but only if the day of week is Monday through Friday.

      • 5

        Add any extra lines for other jobs that need to be run periodically. Then save and exit from the editor.

        Cron will run the program automatically at the time listed in the crontab file. Cron checks the crontab file every minute to see if there are any jobs scheduled in the crontab file to run.

    Related Searches

    References

    • Photo Credit plex

    Read Next:

    Comments

    You May Also Like

    Follow eHow

    Related Ads