diff options
author | Case Duckworth | 2022-06-17 10:11:39 -0500 |
---|---|---|
committer | Case Duckworth | 2022-06-17 10:11:39 -0500 |
commit | 0751fdae16335ac6d9b6aaba77483a05d3151f8d (patch) | |
tree | f427e4f2cc3444249b20119e9b3b31256e0836aa /extra | |
parent | Fix argument handling (diff) | |
download | qotd-0751fdae16335ac6d9b6aaba77483a05d3151f8d.tar.gz qotd-0751fdae16335ac6d9b6aaba77483a05d3151f8d.zip |
Diffstat (limited to 'extra')
-rw-r--r-- | extra/qotd-update.service | 9 | ||||
-rwxr-xr-x | extra/qotd-update.sh | 12 | ||||
-rw-r--r-- | extra/qotd-update.timer | 9 |
3 files changed, 30 insertions, 0 deletions
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 @@ | |||
1 | [Unit] | ||
2 | Description=Update qotd.txt | ||
3 | |||
4 | [Service] | ||
5 | Type=oneshot | ||
6 | ExecStart=/usr/local/bin/qotd-update.sh | ||
7 | |||
8 | [Install] | ||
9 | 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 @@ | |||
1 | #!/bin/sh | ||
2 | # update QOTD | ||
3 | |||
4 | qotd_file=$HOME/qotd.txt | ||
5 | |||
6 | awk '{print;}/~ ~ ~/{exit;}' "$qotd_file" >/tmp/qotd | ||
7 | echo >>/tmp/qotd | ||
8 | echo "~ ~ ~" >>/tmp/qotd | ||
9 | echo >>/tmp/qotd | ||
10 | fortune >>/tmp/qotd | ||
11 | |||
12 | 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 @@ | |||
1 | [Unit] | ||
2 | Description=Update qotd.txt every day | ||
3 | |||
4 | [Timer] | ||
5 | OnCalendar=Daily | ||
6 | Persistent=true | ||
7 | |||
8 | [Install] | ||
9 | WantedBy=timers.target | ||