Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Distribution: Slackware 10.2, SmoothWall Express v3, Kubuntu 7.04, Mac OS X.4
Posts: 69
Rep:
Multiple instances of X using startx command
I know it's possible to start a second instance of X using the command
Code:
startx -- :1
. I wonder however if it could also be possible to start a second instance of X without the additional options, e.g. startx searches for the next available display. So if two users are logged in at the same time and both want to use X they do not need to hassle with the commands.
Distribution: Distribution: RHEL 5 with Pieces of this and that.
Kernel 2.6.23.1, KDE 3.5.8 and KDE 4.0 beta, Plu
Posts: 5,700
Rep:
I am not sure where to start but this is a thought. A script that checks to see if display :0 exist. If so then it uses the staxtx :1. Just not sure how to check to see if display :0 or so is active. This might give you a start or someone might continue on with this idea.
If I get some spare time I might look into it further.
Brian1
If you really want to understand it all, read man bash, man sed, man grep, man tail, man sort. And know that bc is a calculator..
Or ask concrete questions
Just for kicks, I am trying this one piece at a time.
I gather that you are looking for all lines with "<X>" in them. On my machine (3 X-servers running) there are no such lines...
Distribution: approximately NixOS (http://nixos.org)
Posts: 1,900
Rep:
What grep do you have? I have (grep --version) 2.5.1 . If you have other version - replace \< by just < and \> by > . This means end-of-word in regexp.
Distribution: Slackware 10.2, SmoothWall Express v3, Kubuntu 7.04, Mac OS X.4
Posts: 69
Original Poster
Rep:
Perhaps I could be a bit more concrete. If you edit for example your kdmrc file (when using kde of course) it is possible to have several 'reserve' Xservers. So when :0 is taken and you want to start up a new session the new session will be on :1. I would like to have the same behavior when starting X from the command line using the startx command. Does anyone know a config file I need to edit for this behavior?
What grep do you have? I have (grep --version) 2.5.1 . If you have other version - replace \< by just < and \> by > . This means end-of-word in regexp.
I also have 2.5.1---Now I realize what /< and /> are supposed to be doing: You are looking for "X" by itself--right?
When I do ps auxwww, this does not occur.
I have a hunch that these are the lines you are trying to find:
Distribution: Distribution: RHEL 5 with Pieces of this and that.
Kernel 2.6.23.1, KDE 3.5.8 and KDE 4.0 beta, Plu
Posts: 5,700
Rep:
No config file I know of. The above help from others for finding a running X server display is a start. Once one determines whether :0 is active, then ones will start :1. What one would do is create a script called lets say startxx. It will run a check (like using the above command like others above have provided) to see if :0 is active if it is it will then check for :1 and so on. Now if :1 is not active then it will issue the command startx :1 like you want. I am not great at scripts but maybe again others can help or study up on simple scripting and write your own. If I get time again I may work on this.
Distribution: approximately NixOS (http://nixos.org)
Posts: 1,900
Rep:
Oops. Pixellany, in your case I would just substitute Xorg for X and have no problems. Just your distro makes this other way than my scripts in LFS system..
Distribution: Distribution: RHEL 5 with Pieces of this and that.
Kernel 2.6.23.1, KDE 3.5.8 and KDE 4.0 beta, Plu
Posts: 5,700
Rep:
Got time to look this over and review the above post and command there Raskin. Looks good and works here. I can issue the command and then do a echo $NUM and shows what $NUM will be. Started a second display and run the command and it showed the value to be 2 since display 0 and 1 were active.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.