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 Sun 21 Sep 2014, 18:19
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 Posts_count  
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.

Edited_time_total
Back to top
View user's profile Send_private_message 
SFR


Joined: 26 Oct 2011
Posts: 1068

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_website 
technosaurus


Joined: 18 May 2008
Posts: 4351

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:   Sort by:   
Page 1 of 1 Posts_count  
Post_new_topic   Reply_to_topic View_previous_topic :: View_next_topic
 Forum index » Off-Topic Area » Programming
Jump to:  

Rules_post_cannot
Rules_reply_cannot
Rules_edit_cannot
Rules_delete_cannot
Rules_vote_cannot
You cannot attach files in this forum
You can download files in this forum


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