问题
I have following line in crontab */1 * * * * xeyes
it does not show any xwindow but on the contrary */1 * * * * touch somefile.txt works fine
Tried to search on google but didnt get any specific answers!!
回答1:
You have to tell cron where to find the X server if the command you run uses it.
So use: env DISPLAY=:0.0 xeyes
or export DISPLAY=:0.0; xeyes
.
Some cron implementations (Debian, Ubuntu, ...) allows to set enviroment simply in cron file.
DISPLAY=:0.0
# m h dom mon dow command
*/1 * * * * xeyes
来源:https://stackoverflow.com/questions/15000398/cron-job-not-working-for-xwindow