I am trying to run a program that pops up a graphical notice to me. As a simple example, I have my cron settings as

@hourly xlogo

and if I launch xlogo from an interactive command, it works fine. However, when run by cron, the xlogo window never launches. How can I get cron to let xlogo launch a window, or is it just fundamentally not designed to do that?


It is totally possible to do this with crontab.

You need to tell the script which screen you want xlogo to run on.

Try changing the line to this:

@hourly /usr/bin/env DISPLAY=:0.0 /usr/bin/xlogo

to tell crontab what display you want it to use. Depending on the program you might need to add in more enviornment variables as well.


You need to tell it which display to use with the export command. I also would recommend always using the full path to a file with cron. It will save you a lot of headaches, as cron runs in a limited environment, so it doesn't always have the same $PATH variable as your terminal. This means it doesn't always know where programs are located.

At any rate, your cron job would look something like this:

@hourly export DISPLAY=:0.0 && /usr/bin/xlogo
  • I tried this and also the version suggested by Alex L. Both of them work fine. Thanks very much! – Stephen Aug 22 '12 at 22:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.