karlherrick.com

Cron crontab window windowed gui app application

Saturday, 09 September 2006

The title shows all of the different terms I was googling for… and what was near impossible to find, I finally found.

Here I am to share my new found knowledge with you. Do you want to run a windowed application with cron? The basics are that you have to export your display.

Yeah, I read that in other places. But where? I thought to myself… Some said, “IN YOUR CRONTAB FILE” Yeah, okay, whatever that means. I would like some more detail. As they say, the devil is in the details. So, with detailed instructions I continue.

If you have your cron permissions setup properly and run:

crontab -e

you can set a cron job that looks something like:

0,30 * * * * export DISPLAY=:0 && killall skype && sleep 5 && skype

So what does this mean? It means, every 30 minutes, run the following commands:

export DISPLAY=:0
killall skype
sleep 5
skype

Okay, difficult to explain… but basically as I understand it, it means: When you run the cron job, it is in a terminal environment. It cannot find the X Windows display without setting the DISPLAY variable within the command string for the cron job.

So, as a recap, set your display variable within the command string of your cron job. 🙂


Home

About

Portfolio

Web Apps Web Enabled Applications Corporate Sites Personal Sites
Preferences Dark Theme Light Theme Notifications
Social GitHub LinkedIn RSS Feed Icon