From: Ian Kelling Date: Fri, 3 Jan 2025 10:45:53 +0000 (-0500) Subject: fix awatch, make it run as a service to avoid being killed by systemd X-Git-Url: https://iankelling.org/git/?a=commitdiff_plain;h=0161ec0755030b7ce317baf2a4b8f1164854afe1;p=distro-setup fix awatch, make it run as a service to avoid being killed by systemd --- diff --git a/filesystem/usr/local/bin/awatch b/filesystem/usr/local/bin/awatch index 5250c20..a483b0b 100755 --- a/filesystem/usr/local/bin/awatch +++ b/filesystem/usr/local/bin/awatch @@ -25,4 +25,4 @@ if [[ $EUID != 1000 ]]; then exit 1 fi echo "awatch: $(date "+%F %T") starting" >>/home/iank/aw.log -DISPLAY=:0 /a/opt/activity-watch/aw-qt &>>/home/iank/aw.log & +DISPLAY=:0 /a/opt/activity-watch/aw-qt &>>/home/iank/aw.log diff --git a/primary-setup b/primary-setup index b7b0585..5df4149 100755 --- a/primary-setup +++ b/primary-setup @@ -99,12 +99,9 @@ if dpkg -s rss2email &>/dev/null; then fi if [[ $HOSTNAME == "$HOST2" ]]; then - if pgrep '^Xorg$'; then - m sudo -u iank /usr/local/bin/awatch - fi + m sudo -u iank XDG_RUNTIME_DIR=/run/user/1000 systemctl --no-block --user enable --now awatch.service ||: else - pkill -f '^/a/opt/activity-watch/aw-qt$' ||: - pkill -f '^/a/opt/activity-watch/aw-server/aw-server$' ||: + m sudo -u iank XDG_RUNTIME_DIR=/run/user/1000 systemctl --no-block --user disable --now awatch.service ||: fi diff --git a/subdir_files/.config/systemd/user/arbtt.service b/subdir_files/.config/systemd/user/awatch.service similarity index 72% rename from subdir_files/.config/systemd/user/arbtt.service rename to subdir_files/.config/systemd/user/awatch.service index 26154dd..7161b34 100644 --- a/subdir_files/.config/systemd/user/arbtt.service +++ b/subdir_files/.config/systemd/user/awatch.service @@ -1,15 +1,15 @@ [Unit] -Description=arbtt +Description=awatch # StartLimitIntervalSec in recent systemd versions StartLimitInterval=0 [Service] Type=simple -ExecStart=/usr/bin/arbtt-capture --sample-rate=15 +ExecStart=/usr/local/bin/awatch Environment="DISPLAY=:0" Restart=always # time to sleep before restarting a service -RestartSec=10 +RestartSec=120 [Install] WantedBy=default.target