diff --git a/bin/mailsync b/bin/mailsync index d79507d..c56ccb2 100755 --- a/bin/mailsync +++ b/bin/mailsync @@ -2,12 +2,13 @@ # Sync mail and give notification if there is new mail. export PATH=$PATH:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin -export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$(id -u)/bus +DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$(id -u)/bus +export DBUS_SESSION_BUS_ADDRESS export DISPLAY=:0.0 [ -d "$HOME/.local/share/password-store" ] && export PASSWORD_STORE_DIR="$HOME/.local/share/password-store" # Run only if user logged in (prevent cron errors) -pgrep -u "$USER" >/dev/null || { echo "$USER not logged in; sync will not run."; exit ;} +pgrep -u "${USER:=$LOGNAME}" >/dev/null || { echo "$USER not logged in; sync will not run."; exit ;} # Run only if not already running in other instance pgrep -x mbsync >/dev/null && { echo "mbsync is already running." ; exit ;}