Re: Cron on certain days?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



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
_______________________________________________
CentOS mailing list
CentOS@xxxxxxxxxx
http://lists.centos.org/mailman/listinfo/centos

[Index of Archives]     [CentOS]     [CentOS Announce]     [CentOS Development]     [CentOS ARM Devel]     [CentOS Docs]     [CentOS Virtualization]     [Carrier Grade Linux]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Linux USB]
  Powered by Linux