Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Mon 20 Oct 2014, 20:38
All times are UTC - 4
 Forum index » Off-Topic Area » Programming
Check, if X is already running? (Solved)
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 1 [5 Posts]  
Author Message
RSH


Joined: 05 Sep 2011
Posts: 2420
Location: Germany

PostPosted: Tue 03 Jun 2014, 04:08    Post subject:  Check, if X is already running? (Solved)  

Hi.

I have some scripts that are running manually executed by menu entry or called from other scripts.

When called from other scripts X is not already running then.

But the scripts usually shows Xdialog messages.

So, how can I check, if X is already running, to avoid error messages in /tmp/bootsysinit.log.
Code:
Xdialog: Error initializing the GUI...
Do you run under X11 with GTK+ v1.2.0+ installed ?

Thanks,

RSH

_________________
LazY Puppy
RSH's DNA
SARA B.

Last edited by RSH on Sat 09 Aug 2014, 14:50; edited 1 time in total
Back to top
View user's profile Send private message 
SFR


Joined: 26 Oct 2011
Posts: 1077

PostPosted: Tue 03 Jun 2014, 06:30    Post subject:  

Hey RSH, this should do:
Code:
[ "$DISPLAY" ] && echo "X" || echo "no X"

Greetings!

_________________
[O]bdurate [R]ules [D]estroy [E]nthusiastic [R]ebels => [C]reative [H]umans [A]lways [O]pen [S]ource
Omnia mea mecum porto.
Back to top
View user's profile Send private message 
RSH


Joined: 05 Sep 2011
Posts: 2420
Location: Germany

PostPosted: Tue 03 Jun 2014, 06:39    Post subject:  

Thanks!
_________________
LazY Puppy
RSH's DNA
SARA B.
Back to top
View user's profile Send private message 
Karl Godt


Joined: 20 Jun 2010
Posts: 3972
Location: Kiel,Germany

PostPosted: Tue 03 Jun 2014, 10:11    Post subject:  

Code:
test "`pidof X`" && echo "X is running" || echo "OK"

would also give a correct message if the program is executed from
an additional linux kernel terminal console,
( switched to by Control+Alt+Fx )
which would not have DISPLAY set.
Back to top
View user's profile Send private message Visit poster's website 
technosaurus


Joined: 18 May 2008
Posts: 4353

PostPosted: Fri 06 Jun 2014, 09:30    Post subject:  

You can also test for a socket at:
/tmp/.X11-unix/X*
Unix domain socket for display number *

This is how I replaced waitforx with a shell function.

_________________
Web Programming - Pet Packaging 100 & 101
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 1 of 1 [5 Posts]  
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Off-Topic Area » Programming
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0498s ][ Queries: 11 (0.0066s) ][ GZIP on ]