You are not logged in.

#1 2013-02-24 08:11:08

mmf1902
Member
From: Mexico city
Registered: 2009-05-08
Posts: 53

[SOLVED] Can't run X application in cronie

Hi there...


Subject states it all. I did what the wiki explains without success. The x app is a script that calls zenity. The script itself works fine when called from command line.

The user with the crontab is member of the users group

[miguel@miguel ~]$ id
uid=1000(miguel) gid=100(users) grupos=100(users)
[miguel@miguel ~]$

I also did a test writing to a text file in the filesystem (to make sure cronie was running) and - as expected - the file was created neutral

Here the packages installed:

xorg-server 1.13.2-1
gnome-shell 3.6.3-2
cronie 1.4.9-2

I'm lost so it would be great if someone have any hints about this subject.

Best,

Last edited by mmf1902 (2013-02-25 05:07:40)

Offline

#2 2013-02-24 08:56:09

Stebalien
Member
Registered: 2010-04-27
Posts: 1,239
Website

Re: [SOLVED] Can't run X application in cronie

Please post the full command/script you are trying to run.


Steven [ web : git ]
GPG:  327B 20CE 21EA 68CF A7748675 7C92 3221 5899 410C

Offline

#3 2013-02-24 09:14:57

mmf1902
Member
From: Mexico city
Registered: 2009-05-08
Posts: 53

Re: [SOLVED] Can't run X application in cronie

Here is the simple bash script:

#!/bin/bash
export DISPLAY=:0.0 ; zenity --notification --text='cronie' --timeout=3

Here is also the crontab

[miguel@miguel ~]$ crontab -l
*0,*5 * * * * /home/miguel/bin/script
[miguel@miguel ~]$

And the status of daemon

[miguel@miguel ~]$ systemctl status cronie.service
cronie.service - Periodic Command Scheduler
	  Loaded: loaded (/usr/lib/systemd/system/cronie.service; enabled)
	  Active: active (running) since dom 2013-02-24 02:29:43 CST; 42min ago
	Main PID: 419 (crond)
	  CGroup: name=systemd:/system/cronie.service
		  ├─ 419 /usr/sbin/crond -n
		  ├─2321 /usr/sbin/anacron -s
		  ├─2391 dbus-launch --autolaunch=8a12598c04f64f4bb39568fa398...
		  └─2392 /usr/bin/dbus-daemon --fork --print-pid 5 --print-ad...

Offline

#4 2013-02-24 18:10:40

Stebalien
Member
Registered: 2010-04-27
Posts: 1,239
Website

Re: [SOLVED] Can't run X application in cronie

You have to set DBUS_SESSION_BUS_ADDRESS to send notifications. This should get you started: https://bbs.archlinux.org/viewtopic.php?id=121788


Steven [ web : git ]
GPG:  327B 20CE 21EA 68CF A7748675 7C92 3221 5899 410C

Offline

#5 2013-02-25 05:03:11

mmf1902
Member
From: Mexico city
Registered: 2009-05-08
Posts: 53

Re: [SOLVED] Can't run X application in cronie

Stebalien you are the one...

Here is the script modified:

[miguel@miguel bin]$ cat script
#!/bin/bash

PIDS=$(pgrep gnome-shell)

for p in $PIDS; do
    dbus=$(grep -z DBUS_SESSION_BUS_ADDRESS /proc/$p/environ | sed 's/DBUS_SESSION_BUS_ADDRESS=//')
    user=$(grep -z USER /proc/$p/environ | sed 's/USER=//')
    dply=$(grep -z DISPLAY /proc/$p/environ | sed 's/DISPLAY=//')
done

export DISPLAY=$dply
export DBUS_SESSION_BUS_ADDRESS=$dbus
zenity --notification --text='cronie' --timeout=3
[miguel@miguel bin]$ 

Thank you very much.

I will change this post as solved.

Best,

Offline

Board footer

Powered by FluxBB