On Sun, Sep 04, 2011 at 10:31:40PM +0800, jida...@jidanni.org wrote: > >> So please add an example, e.g., > >> 0 4 * * 2 echo -e TueLast\\tLast Tuesday of the month|calendar -f > >> /dev/stdin > JFP> Sorry, I'm afraid this example is not correct. It would run every > Tuesday. A > JFP> more approximate example could be this: > Yes, and get filtered... which beats things like > JFP> 0 4 21-31 * * test $(date +%u) -eq 6 && echo "Last Saturday" > which runs ten days a month vs. my four. > Did you notice the filter at the end of my example?
I noticed the filter. I cannot reproduce what you want to achieve. Which 'calendar' program are you using? (the one in bsdmainutils?) In any case, the goal of the example in the manpage is not to print "Last Saturday" but to show how you can write a cron task to run in that specific time slot. I fail to see how (in your example) you can run a task programmed for that time period. In the one provided in the manpage: 0 4 21-31 * * test $(date +%u) -eq 6 && echo "Last Saturday" You can just replace the 'echo' call to run something like this for example: 0 4 21-31 * * test $(date +%u) -eq 6 && backup_important_system_files I fail to see the point of your example. Maybe you could provide more information? Regards Javier
signature.asc
Description: Digital signature