Cron script does not work entirely :(

made some notification script… for simplification I edited it down to this:

#!/bin/sh

export DISPLAY=:0
notify-send -i /usr/share/icons/hicolor/256x256/apps/steam.png 'Main notification' 'additional info'
echo "notification sent!"

executing it via ./sample.sh works perfectly. I see notification in main display.
However, I used to have it applied via crontab installed and it did work perfectly also up until like september-october 2020. and then just stopped displaying the notification part. it still did run according to journald.

[deemon@Zen scripts]$ crontab -l
15 * * * * /home/deemon/scripts/sample.sh

[deemon@Zen scripts]$ systemctl status cronie.service 
● cronie.service - Periodic Command Scheduler
     Loaded: loaded (/usr/lib/systemd/system/cronie.service; enabled; vendor preset: disabled)
     Active: active (running) since Wed 2021-01-13 17:18:48 EET; 1 day 7h ago
   Main PID: 879 (crond)
      Tasks: 3 (limit: 38422)
     Memory: 4.1G
     CGroup: /system.slice/cronie.service
             ├─ 879 /usr/bin/crond -n
             ├─5713 dbus-launch --autolaunch=d0a2d74a5cd9430797d902f5237c448d --binary-syntax --close-stderr
             └─5714 /usr/bin/dbus-daemon --syslog-only --fork --print-pid 5 --print-address 7 --session

jaan  15 00:00:01 Zen CROND[53549]: (root) CMDOUT (Last daily snapshot is 4 hours old)
jaan  15 00:00:01 Zen CROND[53549]: (root) CMDOUT (------------------------------------------------------------------------------)
jaan  15 00:00:01 Zen CROND[53549]: (root) CMDOUT (Maximum backups exceeded for backup level 'daily')
jaan  15 00:01:01 Zen CROND[53635]: (root) CMD (run-parts /etc/cron.hourly)
jaan  15 00:01:01 Zen anacron[53640]: Anacron started on 2021-01-15
jaan  15 00:01:01 Zen anacron[53640]: Normal exit (0 jobs run)
jaan  15 00:15:01 Zen crond[53873]: pam_unix(crond:session): session opened for user deemon(uid=1000) by (uid=0)
jaan  15 00:15:01 Zen CROND[53874]: (deemon) CMD (/home/deemon/scripts/sample.sh)
jaan  15 00:15:03 Zen CROND[53873]: (deemon) CMDOUT (notification sent!)
jaan  15 00:15:03 Zen CROND[53873]: pam_unix(crond:session): session closed for user deemon

but there never is the notification on the screen anymore when it’s executed from crontab :frowning:
What changed? What I have to change to make it great work again?

1 Like