IndianWebPortal.com

Something Different In Linux

Home » cpanel » cronjob for first sunday of the every month.

How to set the Cronjob for first Sunday of the every month.

Ans:

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

OR

You can set it in different format

Create one test script file /home/test.sh

Then enter your script path in the following format into the /home/test.sh file

==============

if [[ "$(date +'%a')" != "Sun" ]]
then
exit 0
else
/script/upcp
fi

==============

And then set the Cron job in following format

00 00 1-7 1-12 * /home/test.sh

Done


Popular Posts

remove index.php fro

How to remove index.php from url in magento Ans : If you ...

PHP-Java bridge on p

  What is php-java bridge? The php-java bridge is the php ...

Set expiration for y

If you want to set the expiration to your site ...

Warning: Parameter 1

Error: Warning: Parameter 1 to modMainMenuHelper::buildXML() expected to be a ...

domain pointing to e

If you domain uses external MX record and it is ...