From 1eb05e539ec54f404ae7367ba12233bbfebfdbf9 Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Fri, 23 Feb 2024 02:47:29 -0500 Subject: convert update-weather to systemd --- cron/Makefile | 9 --------- cron/crontab.stowskip | 1 - i3status/.config/systemd/user/weather.service | 3 +++ i3status/.config/systemd/user/weather.timer | 6 ++++++ i3status/Makefile | 9 +++++++++ local/.bin/hornet/update-weather | 3 ++- packages.hornet | 1 - packages.mz-doy1 | 1 - 8 files changed, 20 insertions(+), 13 deletions(-) delete mode 100644 cron/Makefile delete mode 100644 cron/crontab.stowskip create mode 100644 i3status/.config/systemd/user/weather.service create mode 100644 i3status/.config/systemd/user/weather.timer create mode 100644 i3status/Makefile diff --git a/cron/Makefile b/cron/Makefile deleted file mode 100644 index 22cd971..0000000 --- a/cron/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -include ../Makefile.include - -install: /var/spool/cron/$(USER) - -uninstall: - @crontab -r - -/var/spool/cron/$(USER) : crontab.stowskip - @crontab $< diff --git a/cron/crontab.stowskip b/cron/crontab.stowskip deleted file mode 100644 index 70e80b7..0000000 --- a/cron/crontab.stowskip +++ /dev/null @@ -1 +0,0 @@ -*/15 * * * * /bin/bash -c 'export PATH=~/.bin/$(hostname):~/.bin:/usr/bin:/usr/bin/vendor_perl:$PATH && update-weather' diff --git a/i3status/.config/systemd/user/weather.service b/i3status/.config/systemd/user/weather.service new file mode 100644 index 0000000..2351b21 --- /dev/null +++ b/i3status/.config/systemd/user/weather.service @@ -0,0 +1,3 @@ +[Service] +Type=oneshot +ExecStart=%h/.bin/%H/update-weather diff --git a/i3status/.config/systemd/user/weather.timer b/i3status/.config/systemd/user/weather.timer new file mode 100644 index 0000000..b90e4bf --- /dev/null +++ b/i3status/.config/systemd/user/weather.timer @@ -0,0 +1,6 @@ +[Timer] +OnStartupSec=0 +OnUnitActiveSec=900 + +[Install] +WantedBy=timers.target diff --git a/i3status/Makefile b/i3status/Makefile new file mode 100644 index 0000000..6627473 --- /dev/null +++ b/i3status/Makefile @@ -0,0 +1,9 @@ +include ../Makefile.include + +install: + @systemctl --user enable weather.timer + @systemctl --user start weather.timer + +uninstall: + @systemctl --user stop weather.timer + @systemctl --user disable weather.timer diff --git a/local/.bin/hornet/update-weather b/local/.bin/hornet/update-weather index fad6ff7..fb8afca 100755 --- a/local/.bin/hornet/update-weather +++ b/local/.bin/hornet/update-weather @@ -2,5 +2,6 @@ set -eu set -o pipefail -weather >~/.cache/weather.new +echo "updating weather..." +"$(dirname "$0")"/weather >~/.cache/weather.new mv ~/.cache/weather.new ~/.cache/weather diff --git a/packages.hornet b/packages.hornet index f87a003..93039c7 100644 --- a/packages.hornet +++ b/packages.hornet @@ -1,7 +1,6 @@ alacritty bash crawl -cron fortune-mod gdb git diff --git a/packages.mz-doy1 b/packages.mz-doy1 index 4b5e14b..a9ef767 100644 --- a/packages.mz-doy1 +++ b/packages.mz-doy1 @@ -1,6 +1,5 @@ alacritty bash -cron fortune-mod gdb git -- cgit v1.2.3-54-g00ecf