I mean I want to use this variable at "minute to wday" in the following.

minute   hour    mday    month   wday    who command

Because I want to set these values in some configuration file and want to use those time spans here.


I don't think so that you can use variables as placeholder's there. Following is allowed

  1. Numbers, ranges as hyphen- separated number which can again be separated using comma , example:

    for day-of-month you can write 2-4,8-10, if you need to run the job from 2nd to 4th and 8th to 10th day of month.

  2. One of the following pre-defined ones

@reboot     :    Run once after reboot.
@yearly     :    Run once a year, ie.  "0 0 1 1 *".
@annually   :    Run once a year, ie.  "0 0 1 1 *".
@monthly    :    Run once a month, ie. "0 0 1 * *".
@weekly     :    Run once a week, ie.  "0 0 * * 0".
@daily      :    Run once a day, ie.   "0 0 * * *".
@hourly     :    Run once an hour, ie. "0 * * * *".

If you need something dynamic for a large list of job to be created, I suggest create a shell script that will dump the required crontab timings, which you can place in the crontab file.

unix man page for crontab

  • Thanks mtk. i will write a script to dump the entire entry into the crontab file. Is there any way to remove a particular entry from crontab file.(i mean using any command other than writing the script) – Rajanikanth Jan 7 '13 at 9:49
  • crontab -r removes all the entries. Just edit the crontab to delete particular entries. – mtk Jan 7 '13 at 10:14

I think you have to use standard syntax for crontab and check for user/weekday inside your script.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.