1. 这个可以的,bi-weekly的task
00 08 * * 3 /home/user/user.script
然后在script的开始写上
if [[ $(expr `date +%W` % 2) = 0 ]]; then
exit
fi
2. 每个月第一周的周三
#!/bin/bash DATE=`date +%d` if [ "$DATE" -le "7" ]; then run my commands fi exit
22 09 * * 3 /path/to/call_me_from_cron
3. 每个月最后一个周三执行
很强大的一个帖子
http://www.ibm.com/developerworks/cn/aix/library/au-eventtime.html
30 11 * * 3 /home/ywywyang/patent/patent_meeting_notify.sh
#/bin/bash
this_month_last_wed=`ncal | grep We | awk '{print $NF}'`
current_date=`date +%d`
if [[ $current_date -eq $this_month_last_wed ]]; then
your script
fi
后来发现有的系统上没有ncal 只有cal 我又改了下script
#/bin/bash
date=`cal | awk '{print $4}'`
this_month_last_wed=`echo $date | awk '{print $NF}'`
current_date=`date +%d`
if [[ $current_date -eq $this_month_last_wed ]]; then
your script
fi
4. 定时 弹出一个框
30 11 * * * DISPLAY=:0.0 zenity --info --text="take a rest"
00 18 * * * DISPLAY=:0.0 zenity --info --text="go home"