Running Cron every 2 weeks on saturday [duplicate]

we have a cron job that run every Saturday at 01:00 (0 1 * * 6) we want to modified to run every 2 weeks on Saturday at 01:00.

Thanks.

Answer

The simplest way is to wrap your job in a script

 week=$(date +%V); if [ $(( $week % 2 )) -eq 0 ]; then echo "run program"; fi

Then just run the wrapper every week… Change the 0 to a 1 for odd weeks..

Attribution
Source : Link , Question Author : xzeneize , Answer Author : Daniel Widrick

Leave a Comment