run cron job on end of every month

南楼画角 提交于 2019-12-10 23:13:56

问题


I need to run a script at 2 pm on the end of every month. The reason i set 2 pm is i've a timezone of asia/calcutta and it differs 10 hrs and 30 min. from the server time.

I've set date_default_timezone_set('Asia/Calcutta') in my script, so for the current settings i can trigger 1st day of every month as per my timezone.

But the issue is, i'm using webmin and there is no settings to run end of every month and only date from 1 - 31 listed. Here i attached the screenshot.

How can i run the script on end of the every month at 2pm?

Any help greatly appreciated, Thanks!.


回答1:


The simple way, but ugly

is set to run on every 28,29,30,31 days. Each time when script is launched compare current day with max days in current month using bash/oerl script




回答2:


Have it run every day starting the 28th of every month through the first of the next month. In the script, check if tomorrow is the first day of a month. If so, run, else die.



来源:https://stackoverflow.com/questions/8352036/run-cron-job-on-end-of-every-month

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!