From 0751fdae16335ac6d9b6aaba77483a05d3151f8d Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Fri, 17 Jun 2022 10:11:39 -0500 Subject: Add extra/qotd-update --- extra/qotd-update.service | 9 +++++++++ extra/qotd-update.sh | 12 ++++++++++++ extra/qotd-update.timer | 9 +++++++++ 3 files changed, 30 insertions(+) create mode 100644 extra/qotd-update.service create mode 100755 extra/qotd-update.sh create mode 100644 extra/qotd-update.timer diff --git a/extra/qotd-update.service b/extra/qotd-update.service new file mode 100644 index 0000000..da79953 --- /dev/null +++ b/extra/qotd-update.service @@ -0,0 +1,9 @@ +[Unit] +Description=Update qotd.txt + +[Service] +Type=oneshot +ExecStart=/usr/local/bin/qotd-update.sh + +[Install] +WantedBy=multi-user.target diff --git a/extra/qotd-update.sh b/extra/qotd-update.sh new file mode 100755 index 0000000..b199307 --- /dev/null +++ b/extra/qotd-update.sh @@ -0,0 +1,12 @@ +#!/bin/sh +# update QOTD + +qotd_file=$HOME/qotd.txt + +awk '{print;}/~ ~ ~/{exit;}' "$qotd_file" >/tmp/qotd +echo >>/tmp/qotd +echo "~ ~ ~" >>/tmp/qotd +echo >>/tmp/qotd +fortune >>/tmp/qotd + +mv /tmp/qotd "$qotd_file" diff --git a/extra/qotd-update.timer b/extra/qotd-update.timer new file mode 100644 index 0000000..93b4491 --- /dev/null +++ b/extra/qotd-update.timer @@ -0,0 +1,9 @@ +[Unit] +Description=Update qotd.txt every day + +[Timer] +OnCalendar=Daily +Persistent=true + +[Install] +WantedBy=timers.target -- cgit 1.4.1-21-gabe81