Re: OT: Linux Interview Questions
> >
> > On of my favorite:
> > Q: How does the correct crontab entry looks like to run a script only on
> > the last day of every month?
>
> Very very interesting!
>
> * * * * * [ `date -d tomorrow +%d` -eq '01' ] && /the/script
>
> It is basically a command that runs everyday checking if tomorrow's day
> of month = 01
>
> not exactly the right answer but close enough
>
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
--
Tarek
Reply to: