Personal tools
You are here: Home cmgui Wiki Scheduling cronjobs
Views
FrontPage >> Peters notes >> Cmgui nightly build >>

Scheduling cronjobs

last edited 1 year ago by pbier

Cron is the name of a unix program that enables users to schedule commands or scripts to run automatically at a specified time/date.

To schedule a script to run you add an entry to your crontab file. Each entry in cron is a line made up of six fields, each separated by a space. Althought there is often a system crontab file located in /etc/crontab you will probably edit your own user crontab file. Rather than viewing and editing the file directly, use the crontab utility. You can list the contents using the command crontab -l. Assuming you can use vi you can also edit the contents of the file using crontab -e. If you don't want to use vi you can always change your default editor to something you are familiar with. See Changing your default editor.

The nightly cmiss build jobs are scheduled using cron. To change when they are run you will need to edit the appropriate entry in the crontab file. If you need to do this it may be helpful to review the crontab syntax. See http://en.wikipedia.org/wiki/Crontab for a brief review. For a comprehensive introduction see http://www.unixgeeks.org/security/newbie/unix/cron-1.html

For convenience here are the six fields from wikipedia:

  # Use the hash sign to prefix a comment
  # +---------------- minute (0 - 59)
  # |  +------------- hour (0 - 23)
  # |  |  +---------- day of month (1 - 31)
  # |  |  |  +------- month (1 - 12)
  # |  |  |  |  +---- day of week (0 - 7) (Sunday=0 or 7)
  # |  |  |  |  |
  # *  *  *  *  *  command to be executed

The contents of the crontab file for esu8 is as follows:

  # Compilation and testing.
  0 1  * * * /hpc/cmiss/cmiss_utils/cronjobs/cmiss_cronjobs_daily_esu8.sh

  # Collect and summarize testing results.
  50 6 * * * ssh bioeng22 exec /hpc/cmiss/cmiss_utils/cronjobs/cmiss_cronjobs_daily_final.sh

This runs the script cmiss_cronjobs_daily_esu8.sh at 1:00am every day and the script cmiss_cronjobs_daily_final.sh at 6:50am every day.

If you need to disable the scripts from running over the weekend (eg because of server maintenance) you could edit the crontab file so the scripts are run every week day only:

  # Compilation and testing.
  0 1  * * 1-5 /hpc/cmiss/cmiss_utils/cronjobs/cmiss_cronjobs_daily_esu8.sh

  # Collect and summarize testing results.
  50 6 * * 1-5 ssh bioeng22 exec /hpc/cmiss/cmiss_utils/cronjobs/cmiss_cronjobs_daily_final.sh

Contributing to this site

Please add to the wiki any relevant information that you think might be useful to other users of this website. For example, you might like to contribute your experiences, questions and answers.

You are encouraged to contribute to this site regardless of your level of experience. Contributions are welcomed from new and regular visitors.

If you ask a question and receive an answer from a developer you should record it in the wiki. This information is extremely useful and can help other users overcome the same problem.

See how to add and edit pages for more information.