From 43955dc3cf4988411ed65ac20043f02233ae5876 Mon Sep 17 00:00:00 2001 From: Linnea Gräf Date: Mon, 12 May 2025 20:46:13 +0200 Subject: add systemd timer --- source/app.d | 3 ++- systemd/boobbot.service | 13 +++++++++++++ systemd/boobjob.timer | 11 +++++++++++ 3 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 systemd/boobbot.service create mode 100644 systemd/boobjob.timer diff --git a/source/app.d b/source/app.d index b60e192..1fc10af 100644 --- a/source/app.d +++ b/source/app.d @@ -14,5 +14,6 @@ void main() ); auto boobFormat = "boob is short for\n\n" ~ generator.formatBackronymList("boob"); - writefln("%s", misskey.createNote(new BasicNote("public", boobFormat))); + writefln("-- dry --\n%s", boobFormat); +// writefln("%s", misskey.createNote(new BasicNote("public", boobFormat))); } diff --git a/systemd/boobbot.service b/systemd/boobbot.service new file mode 100644 index 0000000..67a5584 --- /dev/null +++ b/systemd/boobbot.service @@ -0,0 +1,13 @@ +# Service to load and execute the boobbot timer + +[Unit] +Description=Posts a boob joke to fedi +Wants=boobjob.timer + +[Service] +Type=oneshot +ExecStart=$SOURCE/boobbot +EnvironmentFile=$SOURCE/.env + +[Install] +WantedBy=multi-user.target diff --git a/systemd/boobjob.timer b/systemd/boobjob.timer new file mode 100644 index 0000000..df6354b --- /dev/null +++ b/systemd/boobjob.timer @@ -0,0 +1,11 @@ +# Timer for posting a boob joke once a day +[Unit] +Description=Posts a boob joke +Requires=boobbot.service + +[Timer] +Unit=boobbot.service +OnCalendar=daily + +[Install] +WantedBy=timers.target -- cgit