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 case you are new to cron then refer to the Article
No. 16 and Article No. 17 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.
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
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
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
note that it is preferred that these lines which set environment
variables should be at the beginning of the crontab file.