Library Technology - Reviews, Tips, Giveaways, Freeware

Library Technology – Reviews, Tips, Giveaways, Freeware

Linux tips: Running X Windows Applications using Cron – Part III

Posted In Linux - By Techtiplib on Saturday, June 23rd, 2012 With No Comments »

This is the third article in the Cron Series. The other two articles explained how to start using cron and the various ways to work with the crontab file. This article shall explain a few more settings that you can do with cron in Linux.

In case you are new to cron then refer to the Scheduling tasks using Cron – Part I and Scheduling tasks using Cron – Part II which explain how to get started with cron.


Many users get excited with the possibilities of cron and immediately come up with many ideas to schedule their applications using cron. But when they try to run their X Windows Applications using cron they get an error – that the necessary environment was not found.

Cron doesn’t require a display to run its tasks (normal tasks such as backing up data by running some script). But in case you want to run an application that requires a display (such as X Windows applications) then you have to tell cron where it could find that display on which it should run the application. The way to do this is to add a simple line to your crontab file as follows


That’s it. This line tell cron that the display it requires to run the windowed applications is found at 0 (tty7). Most of the users will get their X Windows applications to run with this.

Actually this line sets the environment variable DISPLAY. It is the value of this variable that cron uses to run the selected application. Similarly you could set other variables too in the crontab file. Any variable that your applications may require in order to run (such as a different path for your home directory) can be set as follows


Take note that it is preferred that these lines which set environment variables should be at the beginning of the crontab file.


More contents in: ,

About - Hey, this blog belongs to me! I am the founder of TechTipLib and managing editor right now. And I love to hear what do you think about this article, leave comment below! Thank you so much...