cronjob for first sunday of the every month.

How to set the Cronjob for first Sunday of the every month.
You can not set such type of cron by using the cPanel. I have used  following script to set this cron. This script detect the first Sunday of every month and then execute the defined script.
Add the following Cron to execute the “/script/upcp” command first Sunday of every month.
00 00 1-7 1-12 * if [ “$(date +%a) = “Sun” ]; then /script/upcp; fi
You can set it in different format
Create one test script file /home/
Then enter your script path in the following format into the /home/ file
if [[ "$(date +'%a')" != "Sun" ]]
exit 0

And then set the Cron job in following format
00 00 1-7 1-12 * /home/

Related posts

Leave a Comment