marsen
marsen

Reputation: 101

how to use crontab to run a Graphical program such as "gedit"

how to use crontab to run a Graphical program such as "gedit"

57 12 * * * gedit --display=localhost:0

Can not successfully open the program and display it.

Upvotes: 2

Views: 1647

Answers (1)

Domain
Domain

Reputation: 11808

--display=localhost:0 can be causing error ,

Following code will also do the trick

 57 12 * * * export DISPLAY=:0 && /usr/bin/gedit

There is a reason why i added entire path of gedit ,

Utilities in /bin and /usr/bin can be opened using cron just by specifying its name so /usr/bin/gedit or just gedit will work. May a time command you use to start certain utility on terminal doesn't work using cron ,this is because cron passes a minimal set of environment variables to your jobs.May be required env PATH variable is not available with Cron hence it is not able to locate that utility.

you can find a detailed explanation in first reply here.

Upvotes: 3

Related Questions