Checking whether a script can open a display?
Robert Brockway
rbrockway-wgAaPJgzrDxH4x6Dk/4f9A at public.gmane.org
Tue Mar 1 22:03:22 UTC 2005
On Tue, 1 Mar 2005, William O'Higgins wrote:
> I use a cron job to update the backdrop (root window) of my window
> manager. Sometimes I am not running X, however, and then my mail box
> fills up with cron telling me that it cannot open display :0.0. Is
> there a way I can test whether I can open that display so I can quit
> cleanly?
Just get the script to check if you are running under X. One option is to
check if the DISPLAY environment variable is set.
zen:~$echo $DISPLAY
avon.opentrend.net:0.0
It is possible to run X without $DISPLAY set but then the script would
fail to change the root window anyway :)
Rob
--
Robert Brockway B.Sc.
Senior Technical Consultant, OpenTrend Solutions Ltd.
Phone: 416-669-3073 Email: rbrockway-wgAaPJgzrDxH4x6Dk/4f9A at public.gmane.org http://www.opentrend.net
OpenTrend Solutions: Reliable, secure solutions to real world problems.
Contributing Member of Software in the Public Interest (http://www.spi-inc.org)
--
The Toronto Linux Users Group. Meetings: http://tlug.ss.org
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://tlug.ss.org/subscribe.shtml
More information about the Legacy
mailing list