aboutsummaryrefslogtreecommitdiff
path: root/articles/2025/Anacron-on-Artix.html
diff options
context:
space:
mode:
authorPhilip Wittamore <philip@wittamore.com>2026-07-12 11:08:50 +0200
committerPhilip Wittamore <philip@wittamore.com>2026-07-12 11:08:50 +0200
commit420ceb49b53a8fa9d8ba8443e42e50cd7bd7cea9 (patch)
tree3009f0564d75e3f7d1ca38507e7ebb92deaded07 /articles/2025/Anacron-on-Artix.html
update
Diffstat (limited to 'articles/2025/Anacron-on-Artix.html')
-rwxr-xr-xarticles/2025/Anacron-on-Artix.html93
1 files changed, 93 insertions, 0 deletions
diff --git a/articles/2025/Anacron-on-Artix.html b/articles/2025/Anacron-on-Artix.html
new file mode 100755
index 0000000..624a53a
--- /dev/null
+++ b/articles/2025/Anacron-on-Artix.html
@@ -0,0 +1,93 @@
+<!doctype html>
+<html lang="EN">
+ <head>
+ <meta charset="utf-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1">
+ <link rel="stylesheet" href="/style.css">
+ <title>Anacron on Artix</title>
+ </head>
+ <body>
+ <header>
+ <h1>Bloggings</h1>
+ <a href="/index.php">Back</a>
+
+ </header>
+
+<main>
+<article>
+<h2>Anacron on Artix</h2>
+<h3>2025-06-16</h3>
+<h4>On Arch Anacron is a systemd process</h4>
+<p>Anacron ensures cron scripts are run on machines that are frequently powered off</p>
+<p>On Artix it can be run via cron (cronie)</p>
+
+<h3>The /etc/crontab file</h3>
+
+<code># /etc/crontab: configuration file for cron
+# See cron(8) and crontab(5) for details.
+# m h dom mon dow user command
+
+SHELL=/bin/bash
+PATH=/sbin:/bin:/usr/sbin:/usr/bin
+MAILTO=root
+HOME=/
+
+# run-parts
+# (also runs the 0anacron script every hour)
+12 * * * * root run-parts /etc/cron.hourly
+22 10 * * * root run-parts /etc/cron.daily
+32 10 * * 0 root run-parts /etc/cron.weekly
+42 10 1 * * root run-parts /etc/cron.monthly
+</code>
+
+<h3>The /etc/cron.hourly/0anacron script</h3>
+
+<code>#!/bin/sh
+# Check whether 0anacron was run today already
+if test -r /var/spool/anacron/cron.daily; then
+day=`cat /var/spool/anacron/cron.daily`
+fi
+if [ `date +%Y%m%d` = "$day" ]; then
+exit 0;
+fi
+
+# Do not run jobs when on battery power
+if test -x /usr/bin/on_ac_power; then
+/usr/bin/on_ac_power >/dev/null 2>&1
+if test $? -eq 1; then
+exit 0
+fi
+fi
+/usr/sbin/anacron -s
+</code>
+
+<h3>The /etc/anacrontab file</h3>
+
+<code># /etc/anacrontab: configuration file for anacron
+
+# See anacron(8) and anacrontab(5) for details.
+
+SHELL=/bin/sh
+PATH=/sbin:/bin:/usr/sbin:/usr/bin
+MAILTO=root
+# the maximal random delay added to the base delay of the jobs
+RANDOM_DELAY=45
+# the jobs will be started during the following hours only
+START_HOURS_RANGE=3-22
+
+#period in days delay in minutes job-identifier command
+1 5 cron.daily nice run-parts /etc/cron.daily
+7 25 cron.weekly nice run-parts /etc/cron.weekly
+@monthly 45 cron.monthly nice run-parts /etc/cron.monthly
+</code>
+
+ </article>
+</main>
+<footer>
+
+ <p>&nbsp;</p>
+
+ <p>ยง</p>
+ </footer>
+</body>
+</html>