[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: OT: Linux Interview Questions





On 3/15/07, Andrew Sackville-West <andrew@farwestbilliards.com> wrote:

On Thu, Mar 15, 2007 at 06:26:25PM -0300, Jorge Peixoto de Morais Neto wrote:
> >
> >Ok so the min hour thing is wrong on the crontab. It should be something
> >like this:
> >
> >00 06 * * * [ `date -d tomorrow +%d` -eq '01' ] && /the/script
> >
> >for 6:00 AM on the last day of each month
>
>
>
> I didn't know it was possible to put this kind of thing (the output of a
> command) in crontab. I searched for it in the man page and could not find it
> ( man 5 crontab on a Gentoo system). Interesting indeed.
>
 

its not really "putting the output in the crontab". Its just testing
the command to see if it works. If it tests true then its will execute
the next command after the &&. otherwise, it will fail and the whole
command will then fail.
I'm sorry, I had misread the command. I know the && sintax. My eyes had skipped the && and I thought that the [ `date -d tomorrow +%d` -eq '01' ] was one of the crontab fields (which amused me). I would have understood it correctly if I had seen the &&.

Sorry.


Software is like sex: it is better when it is free.
Reply to: