Re: Cron on certain days?

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



On Jan 28, 2008 2:26 PM, Scott Ehrlich <scott@xxxxxxx> wrote:
Is it possible for me to schedule cron to say run script A on the first
Friday of the month, script B on the second Friday of the month, script C,
etc.?

I think you can make cronjob run on every Friday, and in your script
 check if date is 2nd (3rd) Friday.

OTOH, if you specify days and day of week, I think they will both match,
 which is not what you want.

I found this with google:
<http://www.computing.net/unix/wwwboard/forum/2731.html>

Which leads to something along these lines ...

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


HTH,
-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