October 3, 201015 yr I have to schedule some job on every alternate Thursday with Cron. I am not sure How to schedule in job in above case ? Can anyone help me please ??
October 3, 201015 yr You can set the crontab to run every Thursday and then let the script decide what week it is. e.g * * * * 4 ./my-cron-script.sh #!/bin/sh WK=`date +%W` ON_WK=`expr $WK % 2` if [ $ON_WK = 1 ]; then echo 'Hello World'; else echo 'Goodbye World'; fi There are other methods posted up on google as well.
October 17, 201015 yr Author You can set the crontab to run every Thursday and then let the script decide what week it is. e.g * * * * 4 ./my-cron-script.sh #!/bin/sh WK=`date +%W` ON_WK=`expr $WK % 2` if [ $ON_WK = 1 ]; then echo 'Hello World'; else echo 'Goodbye World'; fi There are other methods posted up on google as well. thanks..........!!!!!!
October 17, 201015 yr NP, make sure you set the script to only run once, that code above i posted will run every second of every hour on a thursday... 0 0 * * 4 is probably what you're after
Create an account or sign in to comment