From e2a62cb2a1e9d79e3d263c33dfefdd7cf7652b93 Mon Sep 17 00:00:00 2001 From: Colin Powell Date: Sat, 20 Jul 2019 14:06:16 -0400 Subject: [PATCH] Adding mail syncing with home server --- systemd/.config/systemd/user/syncmail.service | 8 ++++++++ systemd/.config/systemd/user/syncmail.sh | 11 +++++++++++ systemd/.config/systemd/user/syncmail.timer | 13 +++++++++++++ 3 files changed, 32 insertions(+) create mode 100644 systemd/.config/systemd/user/syncmail.service create mode 100755 systemd/.config/systemd/user/syncmail.sh create mode 100644 systemd/.config/systemd/user/syncmail.timer diff --git a/systemd/.config/systemd/user/syncmail.service b/systemd/.config/systemd/user/syncmail.service new file mode 100644 index 0000000..0f1835a --- /dev/null +++ b/systemd/.config/systemd/user/syncmail.service @@ -0,0 +1,8 @@ +[Unit] +Description=Sync mail with Rhea +RefuseManualStart=no +RefuseManualStop=yes + +[Service] +Type=oneshot +ExecStart=/home/powellc/.config/systemd/user/syncmail.sh diff --git a/systemd/.config/systemd/user/syncmail.sh b/systemd/.config/systemd/user/syncmail.sh new file mode 100755 index 0000000..772b81c --- /dev/null +++ b/systemd/.config/systemd/user/syncmail.sh @@ -0,0 +1,11 @@ +#!/bin/sh + +STATE=`nmcli networking connectivity` + +if [ $STATE = 'full' ] +then + muchsync rhea.unbl.ink + exit 0 +fi +echo "No internet connection" +exit 0 diff --git a/systemd/.config/systemd/user/syncmail.timer b/systemd/.config/systemd/user/syncmail.timer new file mode 100644 index 0000000..757ced6 --- /dev/null +++ b/systemd/.config/systemd/user/syncmail.timer @@ -0,0 +1,13 @@ +[Unit] +Description=Sync mail with rhea every 3 minutes +RefuseManualStart=no +RefuseManualStop=no + +[Timer] +Persistent=false +OnBootSec=3min +OnUnitActiveSec=3min +Unite=syncmail.service + +[Install] +WantedBy=default.target