Thursday, September 29, 2022

Using cron to schedule GUI programs

I needed to schedule a GUI program . I chose cron to do it however cron is not meant to schedule GUI programs . Cron does not know anything about user environments so u'd need to pass vars to it. For example the $DISPLAY env  var   


To edit/create a local crontab

crontab -e 

Here I am running a GUI program at 12:15 AM and terminating it at 5:50 AM ( there are better ways to terminate though ;) )

15 00 * * * DISPLAY=:0 /usr/bin/somegui

50 05 * * *  /usr/bin/pkill somegui

No comments:

Post a Comment