cron job not working for xwindow

后端 未结 1 1802
囚心锁ツ
囚心锁ツ 2021-01-28 20:15

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

相关标签:
1条回答
  • 2021-01-28 21:05

    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
    
    0 讨论(0)
提交回复
热议问题