Run cron jobs at last day of the month

| | Comments (0)

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. 系统管理員工具包: 時間和事件管理

Leave a comment

March 2009

Sun Mon Tue Wed Thu Fri Sat
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 31        

About this Entry

This page contains a single entry by Pank published on February 27, 2007 10:25 AM.

Virtual PC 2007 was the previous entry in this blog.

Microsoft's WGA Joke is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.