Linux: Gnome Scheduler (crontab):Error: Can't connect to X11 window server --- workaround
*** workaround:
Gnome Scheduler (crontab) does not support setting environment variables for recurrent tasks, but it will do soon. In the meantime, manually create a script that first defines DISPLAY variable and then calls the graphical application. Finally, you can create a recurrent task to launch the script.
This shell script now runs the Sikuli Script successfully when the task is launched from the crontab. The secret ingredient was the line "xhost local:" Without it, setting the DISPLAY variable did nothing.
#!bin/bash
DISPLAY=:0; export DISPLAY
xhost +local:
/usr/share/
#end script
-------
Hi there,
I have built a Sikuli Script that runs successfully from command line in linux: OS Debian 6.0.2 GNOME Desktop Version 2.30.2
This is how I would run the script directly (using full paths) in my user session:
/usr/share/
Next I want to be able to run this script daily at a specified time using crontab (my username).
This https:/
So I have followed the suggestion when specifying the job in the crontab (my username)
15 15 * * * env DISPLAY=:0 /usr/share/
However, this error occurs when the cronjob runs (the error is emailed from the cron-daemon):
-------
No protocol specified
Exception in thread "main" java.lang.
at sun.awt.
at sun.awt.
at sun.awt.
at java.security.
at sun.awt.
at java.lang.
at java.lang.
at java.awt.
at sun.awt.
at java.lang.
at java.lang.
at java.awt.
at java.security.
at java.awt.
at javax.swing.
at javax.swing.
at org.sikuli.
at org.sikuli.
Could not find the main class: org.sikuli.
-------
Do you have any other suggestions? Surely other folks must successfully execute their Sikuli Scripts via linux cronjobs.
Thanks.
Carla
ADDENDUM:
This is how I solved the issue. More reading tells me this:
-----------------
Gnome Scheduler (crontab) does not support setting environment variables for recurrent tasks, but it will do soon. In the meantime, manually create a script that first defines DISPLAY variable and then calls the graphical application. Finally, you can create a recurrent task to launch the script.
-----------------
This shell script now runs the Sikuli Script successfully when the task is launched from the crontab. The secret ingredient was the line "xhost local:" Without it, setting the DISPLAY variable did nothing.
#!bin/bash
DISPLAY=:0; export DISPLAY
xhost +local:
/usr/share/
#end script
---
cg
Question information
- Language:
- English Edit question
- Status:
- Solved
- For:
- SikuliX Edit question
- Assignee:
- No assignee Edit question
- Last query:
- Last reply: