2

is it possible to show the results in terminal or any other gui by a cron.

for example I just write a script to show the time at terminal at each minute. but it does nothing. So is it possible to cron can show results in GUI.

agarwal_achhnera
  • 2,582
  • 9
  • 55
  • 84

1 Answers1

5

You can do this by setting the DISPLAY variable to :0. For instance:

* * * * * export DISPLAY=:0; gedit

This crontab line will open the gui software gedit every minute.

julienc
  • 19,087
  • 17
  • 82
  • 82
  • This presumes that you have access to the `DISPLAY` you are attempting to connect to. On a single-user system where you are logged in, this may well be the case; but in general, this doesn't work either. – tripleee Dec 15 '17 at 05:15