cron作业不工作的xwindow [英] cron job not working for xwindow
问题描述
我在crontab中有以下行
* / 1 * * * * xeyes
I have following line in crontab */1 * * * * xeyes
它不显示任何xwindow但相反
* / 1 * * * * touch somefile.txt工作正常
it does not show any xwindow but on the contrary */1 * * * * touch somefile.txt works fine
尝试在google上搜索,但没有得到任何特定的答案!
Tried to search on google but didnt get any specific answers!!
推荐答案
如果你运行的命令使用它,你必须告诉cron在哪里找到X服务器。
You have to tell cron where to find the X server if the command you run uses it.
因此使用: env DISPLAY =:0.0 xeyes
或 export DISPLAY =:0.0;
So use: env DISPLAY=:0.0 xeyes
or export DISPLAY=:0.0; xeyes
.
有些cron实现(Debian,Ubuntu,...)允许简单地在cron文件中设置环境。 b
$ b
Some cron implementations (Debian, Ubuntu, ...) allows to set enviroment simply in cron file.
DISPLAY=:0.0
# m h dom mon dow command
*/1 * * * * xeyes
这篇关于cron作业不工作的xwindow的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!