You are not logged in.

#1 2020-12-20 06:25:36

radiobla
Member
Registered: 2020-02-19
Posts: 65

Cronie and KDE's "Task Scheduler" script not working as expected

I've created a cron task using the KDE's Tasks Scheduler (kcron). In the "backend" I'm using "cronie" (the service is running).

Here goes the script source.

/usr/bin/notify-send -i /home/user/Pictures/deew.png -a "20:4" -u critical "<message>"

Using the Tasks Scheduler itself, I've set DISPLAY=":0" and PATH="/usr/bin:/bin" environment vars.

I've ensured that the script is running (touching a file somewhere), but the notifiy-send, dependent on X11, is not sending a notification to my desktop environment (Plasma) when invoked by cronie.

If I test the script standalone, it works fine. I also tried running it from another TTY and it worked too.

Do you guys have any clues on what I am missing?

I found another post here talking about the same issue, but my case seems slightly different.

Any suggestions are welcome.

Thanks!

Last edited by radiobla (2020-12-20 09:23:30)

Offline

#2 2020-12-20 09:17:24

radiobla
Member
Registered: 2020-02-19
Posts: 65

Re: Cronie and KDE's "Task Scheduler" script not working as expected

Solved it.

I had to set DBUS_SESSION_BUS_ADDRESS env var so notify-send will know who to send the message to through DBus.

I set it to unix:path=$XDG_RUNTIME_DIR/bus where XDG_RUNTIME_DIR is equal to "/run/user/<pid>/bus" on System Settings > Task Scheduler.

I found the solution in an example on ClamAV article on wiki.

Last edited by radiobla (2020-12-21 16:40:29)

Offline

Board footer

Powered by FluxBB