Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Non-text multi-user switching 3

Status
Not open for further replies.

wmg

Technical User
Sep 13, 2001
216
0
0
NZ
HI,

I want to be able to login and have stuff running as me and then switch back to the login screen before I leave for work in the morning so other users can log in and check mail etc while I'm away (but while my stuff is still running).

I know I can CTRL+F? switch to a text mode login screen that won't really do the trick as I need an X session for the others too.

Is there any way to do this? (I'm currently on RH8.0)

Thanks!

wmg We've all heard that a million monkeys banging on a million typewriters will eventually reproduce the entire works of Shakespeare. Now, thanks to the Internet, we know this is not true. [Robert Wilensky, 1997]
 
Why not (from your gui session)
CTRL+ALT+F2
login: <user1>
password: <password>

$ startx -- :1

of course, what type of gui session is determined by one of several things. The easiest is to have a :
/home/user1/.Xclients
/home/user1/.Xclients-default

where the latter file contains something like

#!/bin/bash
exec startkde
#exec gnome-session
#exec wmaker
# etc., etc., etc.

Is this sort of on the right track?

 
Thanks for that Innsun - unfortunately, I got an error that said the X server was already running when I tried that.

Any other ideas? Anyone? We've all heard that a million monkeys banging on a million typewriters will eventually reproduce the entire works of Shakespeare. Now, thanks to the Internet, we know this is not true. [Robert Wilensky, 1997]
 
Red Hat starts tty1-6 as text terminals by default. tty7-12 are therefore reserved/available for gui (&quot;X&quot;) sessions. they of course correspond to cntl-alt-F7 thru F12. In the startx command the &quot;--&quot; separates the client part of the request from the server part. &quot;:n&quot; in the server part, where n is 0-5 in our example, corresponds to tty7-12.

Sorry if I'm rehashing stuff you already know but if you typed :

$ startx -- :1

you should not get an &quot;in use&quot; message concerning the &quot;boot to runlevel 5&quot; gui session running in tty7. Try

$ startx -- :2

...just in case you already have more than 1 X session. I'm no expert as far as technical knowledge, but I know from experience because this (the original post/suggestion) consistently works for me.

Ahhhhh.... what else...
try issuing the &quot;who&quot; command from a terminal (may need to be root). this may or may not show how many gui sessions are running (seems to depend on the distro). look at the who man page for similar commands.

Just some suggestions [thumbsup2]
 
Also, when an X server starts running it creates a lock file. I forget the exact location of these, but you can check them to see which X &quot;screens&quot; are already taken. I also wrote a shell script that automatically checks this for you, I can post it when I get home (at work now) for you, if you want. No promises on it, I'm not a bash scripting expert, but I've used it with redhat and suse and it works fine so far.

-Venkman
 
venkman,

would appreciate that script very much.
I had tried it myself with:
echo Listing possible handles for an existing session
who -w
if [ -f /var/run/console.lock ] ; then
cat /var/run/console.lock
fi


wmg: I'm not hijacking your post - you simply started a good discussion :)
 
Here's the script, but I lied it's in perl. I named the script win (so that my roomates would be able to remember it)... hence why there are print lines which say things like &quot;win is finished&quot;.

Anyways, below you'll find the script. Good luck.
-venkman

#!/usr/bin/perl

print &quot;\nExecuting win: Looking for unlocked displays\n&quot;;
for ($i = 0; $i < 6; $i++) {
$filename = &quot;/tmp/.X$i-lock&quot;;
if (-e $filename) {
print &quot;display $i is locked, trying next display.\n&quot;;
} else {
print &quot;display $i is unlocked, will use this one.\n&quot;;
system(&quot;startx -- :$i&quot;);
last;
}
}

print &quot;win is finished.\n&quot;;
 
This is fantastic guys (no 'hijacking' offense taken InnSun!).

Thanks heaps - looks like this is going to make ditching XP that much easier.

Regards
wmg We've all heard that a million monkeys banging on a million typewriters will eventually reproduce the entire works of Shakespeare. Now, thanks to the Internet, we know this is not true. [Robert Wilensky, 1997]
 
thanx venkman

the script works fine! had a gui running on :0 so it found :1 open and started a new kde session there.

AND although it's perl it looks easily portable into my existing bash &quot;startx interface&quot; script.

(of course, maybe it's time to stop putting off learning perl...)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top