You are not logged in.

#1 2018-06-10 13:28:17

karcher
Member
Registered: 2018-01-09
Posts: 64

Can't launch baloon message with cron

Hi all,

I want to to launch baloon message with cron. In my notes I found this:

DISPLAY=":0.0" 
XAUTHORITY="/home/john/.Xauthority" 
XDG_RUNTIME_DIR="/run/user/1000" 
# Run every 1 Min
* * * * * /home/john/Scripts/notification_test.sh

and the corresponding script:

#!/bin/bash
kdialog --title "Long process completed!" --passivepopup "This popup will disappear in 5 seconds" 5 &

which normally should have worked otherwise it wouldn't be there.
But this was before I reinstall Arch, now it doesn't work.
There are several threads regarding this and I have tried many things without success.
zenity and notify-send also don't work:

notify-send "Test" --display=:0
zenity --warning --width=150 --height=50 --text 'Test!'

All three of them work if I run them in the console.

Any idea what is wrong?

Offline

#2 2018-06-10 13:37:02

seth
Member
Registered: 2012-09-03
Posts: 10,911

Re: Can't launch baloon message with cron

notify-send "Test" --display=:0

does certainly not work from an interactive shell (because there's no "--display" parameter and it's also not relevant, this is dbus driven) but you're general suspicion about the issue is correct, however the relevant variables (for notify-send you're gonna require $DBUS_SESSION_BUS_ADDRESS, see https://gist.github.com/AladW/de1c5676d93d05a5a0e1 on how to dynamically import those environment variables) do not belong into the crontab (but the script that needs them)

Offline

#3 2018-06-13 11:12:15

karcher
Member
Registered: 2018-01-09
Posts: 64

Re: Can't launch baloon message with cron

Nothing did work for me so I finally gave up.

Offline

#4 2019-01-03 23:04:00

Gede
Member
Registered: 2009-09-03
Posts: 16

Re: Can't launch baloon message with cron

I am having the same problem. What exactly are the key environment variables. Or is it a different affair?

I am trying

su -l $USER

to discard most of the environment variables and trying to work my way towards getting notify-send working once more.

I dumped environment variables using

set | grep = > /tmp/environment

and using

source /tmp/environment

to reset them again (handling the read-only variables). It did not work.

Can an experienced user provide some guidance, please?

Offline

#5 2019-01-04 07:44:55

seth
Member
Registered: 2012-09-03
Posts: 10,911

Re: Can't launch baloon message with cron

seth wrote:

or notify-send you're gonna require $DBUS_SESSION_BUS_ADDRESS, see https://gist.github.com/AladW/de1c5676d93d05a5a0e1 on how to dynamically import those environment variables

Offline

#6 2019-01-04 08:44:13

schard
Member
From: Hannover
Registered: 2016-05-06
Posts: 326
Website

Re: Can't launch baloon message with cron

I once wrote a program to solve the problem, that you have at hand. It's free software, so feel free to let yourself be inspired by its code base or even use it.

Offline

#7 2019-01-06 19:17:03

Gede
Member
Registered: 2009-09-03
Posts: 16

Re: Can't launch baloon message with cron

seth wrote:
seth wrote:

or notify-send you're gonna require $DBUS_SESSION_BUS_ADDRESS, see https://gist.github.com/AladW/de1c5676d93d05a5a0e1 on how to dynamically import those environment variables

I appreciate your help, seth. However I got the message

Couldn't get a file descriptor referring to the console

right at the start and I am not knowledgeable enough to fix it.

Offline

#8 2019-01-06 19:57:07

seth
Member
Registered: 2012-09-03
Posts: 10,911

Re: Can't launch baloon message with cron

Usually a permission error. How and where exactly did you run this?
Also output of "id", in doubt, try to add your user to the tty group.

Offline

Board footer

Powered by FluxBB