summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Smith <luke@lukesmith.xyz>2019-05-01 19:51:22 -0400
committerLuke Smith <luke@lukesmith.xyz>2019-05-01 19:51:22 -0400
commitbe2c4c5baa88d2ddc90b4917c58985f6d5d938f8 (patch)
treeeb276ff3609750713c458a2b82cbd1eb82683d9e
parent4bc49aa56c583fbc519878e8f45823eea59e47fa (diff)
only sync if user logged in
-rwxr-xr-xbin/mailsync3
1 files changed, 3 insertions, 0 deletions
diff --git a/bin/mailsync b/bin/mailsync
index 620557c..aea3aee 100755
--- a/bin/mailsync
+++ b/bin/mailsync
@@ -1,6 +1,9 @@
#!/usr/bin/env sh
# Sync mail and give notification if there is new mail.
+# Run only if user logged in (prevent cron errors)
+w | grep "^$USER\W" >/dev/null || exit
+
# Checks for internet connection and set notification script.
ping -q -c 1 1.1.1.1 > /dev/null || exit
command -v notify-send >/dev/null || echo "Note that \`libnotify\` or \`libnotify-send\` should be installed for pop-up mail notifications with this script."