Saturday, May 4, 2024
 Popular · Latest · Hot · Upcoming
7
rated 0 times [  7] [ 0]  / answers: 1 / hits: 11316  / 3 Years ago, tue, may 18, 2021, 1:12:26

I have set a daily anacron job, which runs form /etc/cron.daily. From the /etc/crontab I see it should run daily at 06:25 (or at start-up/reboot).



However when the date changes (00:00) and the computer is up, I dont want anacron to wait till 06:25. If the computer is up I would like to it to run the script as soon as the date changes (00:00). Does it make sense to add a cron job to run anacron @hourly?



Thank you very much


More From » cron

 Answers
4

I found how to do this and summarized it in my blogpost:





If you want to change the behaviour of anacron to execute as soon as the day changes (and not wait till 7:30 as is the default behaviour) do the following:



gksu gedit /etc/cron.d/anacron


and add the last 2 lines (the last line will restart anacron every hour):



01 0    * * *   root test -x /etc/init.d/anacron && /usr/sbin/invoke-rc.d anacron start >/dev/null
01 0 * * * root start -q anacron || :
@hourly root start -q anacron || :

[#41166] Tuesday, May 18, 2021, 3 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
sharall

Total Points: 407
Total Questions: 127
Total Answers: 121

Location: Saint Helena
Member since Fri, Mar 26, 2021
3 Years ago
;