Unix administration - Crontab

This is Interesting: Free IT Magazines  
Home > Archive > Unix administration > June 2004 > Crontab





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Crontab
Antigoni

2004-06-04, 2:51 am

How to run a script the first Monday of every month through crontab
Chris F.A. Johnson

2004-06-04, 2:51 am

On 2004-06-04, Antigoni wrote:
> How to run a script the first Monday of every month through crontab


This runs at midnight; adjust the first 2 parameters to have it
run at another time:

0 0 1-7 * 1 /path/to/script

--
Chris F.A. Johnson http://cfaj.freeshell.org/shell
========================================
===========================
My code (if any) in this post is copyright 2004, Chris F.A. Johnson
and may be copied under the terms of the GNU General Public License
Barry Margolin

2004-06-04, 10:50 am

In article <2iagm2Fkkd58U1@uni-berlin.de>,
"Chris F.A. Johnson" <c.fa.johnson@rogers.com> wrote:

> On 2004-06-04, Antigoni wrote:
>
> This runs at midnight; adjust the first 2 parameters to have it
> run at another time:
>
> 0 0 1-7 * 1 /path/to/script


Incorrect. That runs the script every monday and *also* the first seven
days of every month.

There are two common solutions:

1) Run the script every Monday, and have the script check whether the
day of the month is in the range 1-7.

2) Run the script on days 1-7 of every month, and have it check whether
the current day is Monday.

--
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com