I just want to ask why my cron job is not running on my gui but when I run it on my ssh terminal and gui terminal it runs perfectly.
this is my bash script:
export DISPLAY=:10
Start virtual display
xvfb-run --auto-servernum --server-args=“-screen 0 1920x1080x24”
/path/to/my/bash.sh
and this is my crontab
*/3 * * * * export DISPLAY=:10 && /path/to/my/bash.sh
You have to start the Xvfb before the call to the script (and probably this what you do manually).
So, the command xvfb-run --auto-servernum --server-args=“-screen 0 1920x1080x24”
should be in the bash.sh
file.
Hello HelioGuilherme66, actually xvfb-run --auto-servernum --server-args=“-screen 0 1920x1080x24” is already on my bash script. When I manually run that, it runs perfectly on my terminal. When I edit my crontab and put that path of my bash script, it doesnt.
This is my crontab:
*/3 * * * * export DISPLAY=:10 && /path/to/my/bash.sh
I don’t have much experience with cron jobs, but I would experiment:
- having a single path to the command, moving the DISPLAY export to inside the script
- try to find logs about the execution
- is this your user cron, or root’s? Maybe is running for different user?
- you mention “my GUI”, but the process should not be interactive (I think)
Hi Erick,
Are you sure xvfb-run
is starting on display 10? the default when using --auto-servernum
is 99
https://manpages.ubuntu.com/manpages/trusty/man1/xvfb-run.1.html
I would suggest first you try replaceing --auto-servernum
with --server-num=10
so you can be sure which display is used by xvfb-run
.
Hopefully that helps,
Dave.
1 Like