summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorM3taX <m3tax@cock.li>2018-06-21 19:40:33 +0300
committerGitHub <noreply@github.com>2018-06-21 19:40:33 +0300
commit3bc6c587e60975eee44f6328a0390a51e49ff21f (patch)
treeda2e6f246788bd9ffbf83b5898b42949c48f6943
parent45b9085d7353594c30e6bf2135a35d079a0bf44c (diff)
Add crontab fix
Notify-send requires the $DBUS_SESSION_BUS_ADDRESS environment variable to be set when used with cron.
-rwxr-xr-xmutt-wizard.sh2
1 files changed, 1 insertions, 1 deletions
diff --git a/mutt-wizard.sh b/mutt-wizard.sh
index a81c83c..65fad0e 100755
--- a/mutt-wizard.sh
+++ b/mutt-wizard.sh
@@ -20,7 +20,7 @@ chooseSync() { (cat /var/run/crond.pid && testSync) || dialog --msgbox "No cron
testSync() { (crontab -l | grep .config/mutt/etc/mailsync && removeSync) || addSync ;}
addSync() { min=$(dialog --inputbox "How many minutes should be between mail syncs?" 8 60 3>&1 1>&2 2>&3 3>&-)
- (crontab -l; echo "*/$min * * * * export DISPLAY=:0.0 && $HOME/.config/mutt/etc/mailsync.sh") | crontab - &&
+ (crontab -l; echo "*/$min * * * * eval \"export $(egrep -z DBUS_SESSION_BUS_ADDRESS /proc/$(pgrep -u $LOGNAME i3)/environ)\"; $HOME/.config/mutt/etc/mailsync.sh") | crontab - &&
dialog --msgbox "Cronjob successfully added. Remember you may need to restart or tell systemd/etc. to start your cron manager for this to take effect." 7 60 ;}
removeSync() { ((crontab -l | sed -e '/.config\/mutt\/etc\/mailsync/d') | crontab - >/dev/null) && dialog --msgbox "Cronjob successfully removed. To reactivate, select this option again." 6 60 ;}