only sync if user logged in

This commit is contained in:
Luke Smith 2019-05-01 19:51:22 -04:00
parent 4bc49aa56c
commit be2c4c5baa
No known key found for this signature in database
GPG Key ID: 4C50B54A911F6252

View File

@ -1,6 +1,9 @@
#!/usr/bin/env sh #!/usr/bin/env sh
# Sync mail and give notification if there is new mail. # 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. # Checks for internet connection and set notification script.
ping -q -c 1 1.1.1.1 > /dev/null || exit 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." command -v notify-send >/dev/null || echo "Note that \`libnotify\` or \`libnotify-send\` should be installed for pop-up mail notifications with this script."