在每个月末运行cron作业 [英] run cron job on end of every month
问题描述
我需要在每个月底的下午2点运行脚本.我设定为下午2点的原因是我所在的时区为亚洲/Calcutta,且相差10小时30分钟.从服务器时间开始.
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.
我已在脚本中设置了date_default_timezone_set('Asia/Calcutta')
,因此对于当前设置,我可以根据我的时区触发每月的第一天.
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.
但是问题是,我使用的是webmin,没有设置运行到每个月末,并且仅列出了1-31的日期.在这里,我附上了屏幕截图.
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.
我如何在每个月的下午2点运行脚本?
How can i run the script on end of the every month at 2pm?
非常感谢任何帮助,谢谢!.
Any help greatly appreciated, Thanks!.
推荐答案
简单但丑陋的方法
设置为每28、29、30、31天运行一次.每次启动脚本时,使用bash/oerl脚本将当日与当月的最大天数进行比较
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
这篇关于在每个月末运行cron作业的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!