Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question

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

share|improve this answer
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.

share|improve this answer
Er. What script? – Michael Mrozek Jan 7 '13 at 18:16
@MichaelMrozek The shell snippet that runs at the specified time(s). – Gilles Jan 7 '13 at 23:13

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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