On Fri, Mar 16, 2007 at 01:16:46AM +0200, Atis wrote: > [snip] > >> >00 06 * * * [ `date -d tomorrow +%d` -eq '01' ] && /the/script > >> > > >> >for 6:00 AM on the last day of each month > > [snip] > >when you have multiple commands on a line with && between them, it > >executes them sequentially as long as none of them fail, IOW so long > >as they return 0. the [ ... ] is the 'test' command and it tests the > >statement inside the brackets and returns a 0 if the statement is > >true. if its false (i.e. `date -d tomorrow +%d` is '02') then it will > >return a 1 and the whole statement will fail. > > Damn, so this is just a cheat, as the actual command is > [ `date -d tomorrow +%d` -eq '01' ] && /the/script > and it will be executed every day.. >
Yes its a cheat. The correct answer is that having __cron__ run something only on the last day of a month is impossible. Cron itself runs every minute of every day. I guess any type of alarm clock has to run at intervals equal to its granularity. A wall clock tics every second for example. Personally, I find bash scripting very cryptic and I don't mean that as a compliment to bash. If I had to run a command on the last day of the month I would just write a Python script that did this kind of testing and have it run as part of cron.daily. Doug. -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]