syntax for bi-weekly cron job?
Preston Hagar
prestonh at gmail.com
Thu Dec 4 16:13:42 CST 2008
On Thu, Dec 4, 2008 at 1:21 PM, Brandon Coale
<brandoncoale at sbcglobal.net> wrote:
> I use RHEL4 on a DELL PowerEdge server, and I want to have a cron job run at 8:30 AM every other Monday. I think this might be the right syntax:
>
> 30 8 */14 * mon command
>
> What I'm not sure of is if this means the Monday has to fall on the 14th of the month, or if it means every 14 days?
>
> Thank you,
> Brandon Coale
>
That will actually run the command every 14th day (on the 14th of the
month and the 28th of the month) as well as every Monday. From the
crontab(5) manpage:
''30 4 1,15 * 5'' would cause a command to be run at 4:30 am on the
1st and 15th of each month, plus every Friday.
One way to try it without having to modify your script would be to do
something like the following:
30 8 1-7, 15-21, 29-31 * * test `date +\%a` = Mon && command
It is a little messy, but you only options may be something like this,
or checking for every other Monday in your script.
Hope this helps,
Preston
More information about the Linux-PowerEdge
mailing list