Making things go automagically

less than 1 minute read

Was working away at work today and required to have a PERL script to be loaded every Friday. To do this, I had to employ the help of crontab.

usage:  crontab [-u user] file
crontab [-u user] [ -e | -l | -r ]
(default operation is replace, per 1003.2)
-e      (edit user's crontab)
-l      (list user's crontab)
-r      (delete user's crontab)
-i      (prompt before deleting user's crontab)
-s      (selinux context)

  • A minute, expressed as a number from 0 through 59.
  • An hour, expressed as a number from 0 through 23.
  • A day of the month, expressed as a number from 1 through 31.
  • A month of the year, expressed as a number from 1 through 12.
  • A day of the week, expressed as a number from 0 through 6 (with 0 standing for Sunday).

Example of usage includes:

5 6 * * 1-5    command
10 8,14 * * 1-5  command

There will always be 5 specifications. A static number, static numbers with commas in between, a range between numbers with a dash or an asterisk to represent all possible values.

Leave a Comment

Your email address will not be published. Required fields are marked *

Loading...