<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<p><br>
</p>
<div class="moz-cite-prefix">On 11/9/18 8:57 AM, Stephen Worthington
wrote:<br>
</div>
<blockquote type="cite"
cite="mid:fe4budls74hi0vi19uuc5o7vui7q30bog2@4ax.com">
<pre class="moz-quote-pre" wrap="">On Fri, 9 Nov 2018 08:51:41 -0500, you wrote:
</pre>
<blockquote type="cite">
<pre class="moz-quote-pre" wrap="">Now that we've seen the anacron daily changed successfully to 7:30am. I
wanted to see exactly how to accomplish this correctly and document it.
So the plan is to change from 7:30am to 5:30am and see if one set of
commands will do this.
Here is the console output with the commands:
jim@mythbuntu:~$ *sudo systemctl edit anacron.timer* # all I changed was
the 7 to a 5, and the description.
jim@mythbuntu:~$ *sudo systemctl daemon-reload*
jim@mythbuntu:~$ *sudo systemctl restart anacron.timer*
jim@mythbuntu:~$ *sudo systemctl cat anacron.timer*
# /lib/systemd/system/anacron.timer
[Unit]
Description=Trigger anacron every hour
[Timer]
OnCalendar=hourly
RandomizedDelaySec=5m
Persistent=true
[Install]
WantedBy=timers.target
# /etc/systemd/system/anacron.timer.d/override.conf
[Unit]
Description=Trigger anacron at 05:30, instead of midnight, the default
for Ubunt
[Timer]
OnCalendar=
OnCalendar=05:30
RandomizedDelaySec=0s
Persistent=true
jim@mythbuntu:~$ sudo systemctl status anacron.timer
? anacron.timer - Trigger anacron at 05:30, instead of midnight, the
default for
Loaded: loaded (/lib/systemd/system/anacron.timer; enabled; vendor
preset: en
Drop-In: /etc/systemd/system/anacron.timer.d
??override.conf
Active: active (waiting) since Fri 2018-11-09 08:44:08 EST; 16s ago
Trigger: Sat 2018-11-10 05:30:00 EST; 20h left
Nov 09 08:44:08 mythbuntu systemd[1]: Stopping Trigger anacron at 05:30,
instead
Nov 09 08:44:08 mythbuntu systemd[1]: Started Trigger anacron at 05:30,
instead
jim@mythbuntu:~$
Do now we wait and see what happens tomorrow. I will not reboot at this
time.
Jim A
</pre>
</blockquote>
<pre class="moz-quote-pre" wrap="">
That looks good. The status is showing that anacron.timer will
trigger at 05:30. But we really will have to wait and see if it
actually happens. For debugging purposes, you can change the time to
something that is only minutes away, if you do not want to wait that
long.
_</pre>
</blockquote>
<p>So my DB maintenance ran a 5:35am as expected. So if I want to
run all my daily maintenance task along with the systems task, but
delay that from midnight to ~5:30 the steps are:</p>
<p>1. move scripts to the /etc/cron.daily directory</p>
<p>2. sudo systemctl edit anacron.timer # add the following text
when editor opens:<b><br>
</b></p>
<pre class="moz-quote-pre" wrap="">[Unit]
Description=Trigger anacron at 05:30, instead of midnight, the default for Ubuntu 18.04
[Timer]
OnCalendar=
OnCalendar=05:30
RandomizedDelaySec=0s
Persistent=true</pre>
<p>3. sudo systemctl daemon-reload<br>
4. sudo systemctl restart anacron.timer <br>
</p>
<p>So I now have multiple ways of doing all this timed running of
the DB maintenance. It really boils down to whether all of the
maintenance needs to be moved because recording/transcoding
activity is heavy at that time or whether you just need to run
your own jobs at a certain time.</p>
<p>Thanks for all the help. I've certainly learned more about cron
and anacron.</p>
<p>Jim A</p>
<p><br>
</p>
</body>
</html>