February 27, 2007

Run cron jobs at last day of the month

for Linux
0 8 28-31 * * [ `date -d tomorrow +\%e` -eq 1 ] && do-something

for other Unix,BSD
0 8 28-31 * * [ `echo \`cal\` | awk '{print $NF}'` -eq 1 ] && do-something

More, run cron jobs at last workday of the month
0 8 26-31 * * root [ `echo \`cal | cut -d' ' -f2-6\` | awk '{print $NF}'` -eq `date +%e` ] && do-something

ref. 系统管理員工具包: 時間和事件管理

Posted by pank at February 27, 2007 10:25 AM
Comments

Run cron jobs at last day of the month!

Posted by: 知識台灣 at March 12, 2007 05:48 PM
Post a comment













Remember personal info?