Linux: Run cron job in foreground
For GUI
scripts in cron
, try the following line in a shell
:
crontab -e
Then in crontab
:
0 7 * * * DISPLAY=:0 /PATH/TO/SCRIPT
Try this out on your user's crontab
:
@hourly DISPLAY=:0 xterm -e /path/to/my/script.sh
It will open (hourly) an xterm
with your script executing, and exit after your script exits. Of course, you should modify the @hourly
part to suit your needs.