aboutsummaryrefslogtreecommitdiffstats
path: root/systemd
diff options
context:
space:
mode:
Diffstat (limited to 'systemd')
-rw-r--r--systemd/wa-daemon@.service15
-rw-r--r--systemd/wamail-sync.service8
-rw-r--r--systemd/wamail-sync.timer11
3 files changed, 34 insertions, 0 deletions
diff --git a/systemd/wa-daemon@.service b/systemd/wa-daemon@.service
new file mode 100644
index 0000000..4568ad0
--- /dev/null
+++ b/systemd/wa-daemon@.service
@@ -0,0 +1,15 @@
+[Unit]
+Description=wa-cli: WhatsApp Web session (account %i)
+After=network-online.target
+Wants=network-online.target
+
+[Service]
+Type=simple
+ExecStart=%h/.local/bin/wa daemon start --foreground --account %i
+# If WhatsApp Web disconnects or Chrome dies, the daemon exits with 1 and is restarted.
+Restart=on-failure
+RestartSec=15
+TimeoutStopSec=30
+
+[Install]
+WantedBy=default.target
diff --git a/systemd/wamail-sync.service b/systemd/wamail-sync.service
new file mode 100644
index 0000000..c8fb7a6
--- /dev/null
+++ b/systemd/wamail-sync.service
@@ -0,0 +1,8 @@
+[Unit]
+Description=Sync WhatsApp (wa-cli) to a Maildir for neomutt
+After=wa-daemon@default.service
+
+[Service]
+Type=oneshot
+ExecStart=%h/.local/bin/wamail sync
+TimeoutStartSec=15min
diff --git a/systemd/wamail-sync.timer b/systemd/wamail-sync.timer
new file mode 100644
index 0000000..7ad1ce4
--- /dev/null
+++ b/systemd/wamail-sync.timer
@@ -0,0 +1,11 @@
+[Unit]
+Description=Periodic WhatsApp (wamail) sync to a Maildir
+# The daemon hook delivers in real time; the timer reconciles (read state, stars, deletions).
+
+[Timer]
+OnBootSec=3min
+OnUnitActiveSec=5min
+RandomizedDelaySec=20
+
+[Install]
+WantedBy=timers.target