Linux: Run cron job in foreground

只谈情不闲聊 提交于 2019-11-30 09:45:14

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.

For GUI scripts in cron, try the following line in a shell:

crontab -e

Then in crontab :

0 7 * * * DISPLAY=:0 /PATH/TO/SCRIPT

Assuming you are running X, you could always have it open a window on a selected display.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!