Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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
add comment

2 Answers

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
add comment

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
add comment

Your Answer

 
discard

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.