Both commands work when I enter them in the terminal (with the “DISPLAY=:0” part removed). None or the commands work from crontab. The first one (amarok) gives the following mailed to me:
unnamed app(9705): KUniqueApplication: Cannot find the D-Bus session server: "/bin/dbus-launch terminated abnormally with the following error: No protocol specified
Autolaunch error: X11 initialization failed.
"
Could not connect to D-Bus server: org.freedesktop.DBus.Error.Spawn.ExecFailed: /bin/dbus-launch terminated abnormally with the following error: No protocol specified
Autolaunch error: X11 initialization failed.
On 2013-09-04 19:46, Per 68 wrote:
>
> I have the following two lines in my crontab:
>>
>> 0 5 * * 1-5 DISPLAY=:0 amarok -p
>> 45 6 * * 1-5 DISPLAY=:0 qdbus org.ktorrent.ktorrent /core
>> org.ktorrent.core.setSuspended false > /dev/null
That’s 3 lines.
Please, this is difficult to decipher, because lines have wrapped round.
Please use code tags for command outputs and listings - the ‘#’ in the
web editor. View this thread for instructions
Besides that, you can not call a GUI from cron.
–
Cheers / Saludos,
Carlos E. R.
(from 11.4, with Evergreen, x86_64 “Celadon” (Minas Tirith))
Those commands run in the background. It is not even sure that X is running. When X is running, It is not sure that a GUI user is loged in. And even if a GUI user is loged in and is using DISPLAY 0:0 processes may not be allowed to open windows on a display without consent of the owner of that display. Not even root is allowed to do that.
I’ve googled “amarok cron” and found many questions similar to mine. The answer has been to add DISPLAY=:0 to the beginning of the command line and the person asking the question has said it worked in all threads I looked into. These has been gqustions mostly from Ubuntu users, but also from users of Arch and Gentoo. I know from personal experience that it worked on Mageia before I changed to openSUSE. It even worked for me for 2 days a couple of weeks back in openSUSE. It then stopped working without me editing the crontab. Both Amarok and Ktorrent is already running when these commands are executed if that matters.
Hi
Cron by default knows no paths to files etc, have you tried exporting the DISPLAY variable first in your crontab and add the full path to amorak and qdbus;
Assuming both programs are in /usr/bin, you could also set the PATH statement in your crontab. I’m assuming this is for showing some status of those programs?
I’ve solved the problem, or at least found a workaround. The line in crontab doesn’t work if I reboot my computer, but if I log out and log in again as the same user it starts working again.