From a432b366efebdc9ae6e0757169e4a1cea70fa885 Mon Sep 17 00:00:00 2001 From: "martin f. krafft" Date: Thu, 31 Oct 2019 16:15:45 +1300 Subject: [PATCH 1/1] Switch to using systemd-controlled persistent offlineimap --- .../offlineimap@madduck.net.service | 1 + .config/systemd/user/offlineimap@.service | 13 +++++++++++++ .crontab.d/offlineimap | 1 - .gitignore.d/offlineimap | 8 ++++---- 4 files changed, 18 insertions(+), 5 deletions(-) create mode 120000 .config/systemd/user/default.target.wants/offlineimap@madduck.net.service create mode 100644 .config/systemd/user/offlineimap@.service diff --git a/.config/systemd/user/default.target.wants/offlineimap@madduck.net.service b/.config/systemd/user/default.target.wants/offlineimap@madduck.net.service new file mode 120000 index 0000000..9b25838 --- /dev/null +++ b/.config/systemd/user/default.target.wants/offlineimap@madduck.net.service @@ -0,0 +1 @@ +../offlineimap@.service \ No newline at end of file diff --git a/.config/systemd/user/offlineimap@.service b/.config/systemd/user/offlineimap@.service new file mode 100644 index 0000000..a3088f9 --- /dev/null +++ b/.config/systemd/user/offlineimap@.service @@ -0,0 +1,13 @@ +[Unit] +Description=Offlineimap Service for account %i +Documentation=man:offlineimap(1) + +[Service] +ExecStart=/usr/bin/offlineimap -a %i -u quiet +#StandardOutput=file:$RUNTIME_DIRECTORY/offlineimap +#StandardError=file:$RUNTIME_DIRECTORY/offlineimap +Restart=always +RestartSec=60 + +[Install] +WantedBy=default.target diff --git a/.crontab.d/offlineimap b/.crontab.d/offlineimap index 8d01b95..d4c8fa6 100644 --- a/.crontab.d/offlineimap +++ b/.crontab.d/offlineimap @@ -1,2 +1 @@ -*/30 * * * * sleep $((900 * $RANDOM / 32768)) && ip r | grep -q via && [ -e $VARDIR/offlineimap/madduck.net.lock ] || offlineimap -u Quiet -o -a madduck.net 55 */8 * * * sleep $((300 * $RANDOM / 32768)) && ip r | grep -q via && [ -e $VARDIR/offlineimap/madduck.net_bulk.lock ] || offlineimap -u Quiet -o -a madduck.net_bulk diff --git a/.gitignore.d/offlineimap b/.gitignore.d/offlineimap index 91edf56..76a4e79 100644 --- a/.gitignore.d/offlineimap +++ b/.gitignore.d/offlineimap @@ -1,10 +1,10 @@ * -!/.crontab.d +!/.config/systemd/user/default.target.wants/offlineimap@madduck.net.service +!/.config/systemd/user/offlineimap@.service !/.crontab.d/offlineimap -!/.offlineimap +!/.gitignore.d/offlineimap !/.offlineimap/.gitignore !/.offlineimap/helper.py +!/.offlineimap/known_hosts !/.offlineimaprc -!/.var -!/.var/offlineimap !/.var/offlineimap/.gitignore -- 2.39.5