[CentOS] Cron on certain days?

Mon Jan 28 20:11:02 UTC 2008
Bob Beers <bob.beers at gmail.com>

Sloppy cut-n-paste error using -o, so this is obviously wrong ...


> day=`date +%d`
>
> if [ $day -ge 8 -o $day -le 14 ]; then
>
>     echo '2nd Friday'
>
>    # do F2
>
> elif [ $day -ge 15 -o $day -le 21 ]; then
>
>     echo '3rd Friday'
>
>    # do F3
> fi
>

maybe something more like this:

day=$(date +%d)
[[ $day -le 7 ]] && echo "1st Friday" && do_F1 && exit
[[ $day -ge 8 && $day -le 14 ]] && echo "2nd Friday" && do_F2 && exit
[[ $day -ge 15 && $day -le 21 ]] && echo "3rd Friday" && do_F3 && exit
[[ $day -ge 22 && $day -le 28]] && echo "4th Friday" && do_F4 && exit

-Bob
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.centos.org/pipermail/centos/attachments/20080128/7b0cc810/attachment-0005.html>