[comp.unix.aix] "Exit" from mwm

looi@sutro.SFSU.EDU (W. W. Looi) (03/25/91)

I'm new to AIX environment. I wonder if there is a way to "elegantly"
exit from mwm and return to either login or console screen without
resorting to CTRL-ALT-Backspace? I was told that "xstop" will do the
job, but I don't seem to be able to locate it. Worst yet, it's not
documented anywhere in the manual. *sigh*

Also, is there any Sun-like "lockscreen" on AIX? It'd be nice if I can
freeze my screen to avoid unathorative tampering.

Any info will be appreciated. Thanks in advance.

ivan%nepjt@ncsuvx.ncsu.edu (Ivan Maldonado) (03/26/91)

In article <KQPFH0S@linac.fnal.gov> looi@sutro.SFSU.EDU (W. W. Looi) writes:

> From: looi@sutro.SFSU.EDU (W. W. Looi)
> Newsgroups: comp.unix.aix
> Date: 25 Mar 91 04:33:11 GMT
> Sender: daemon@linac.fnal.gov (The Background Man)
> Organization: San Francisco State University
> Lines: 11
> Nntp-Posting-Host: sutro.sfsu.edu


> I'm new to AIX environment. I wonder if there is a way to "elegantly"
> exit from mwm and return to either login or console screen without
> resorting to CTRL-ALT-Backspace? I was told that "xstop" will do the
> job, but I don't seem to be able to locate it. Worst yet, it's not
> documented anywhere in the manual. *sigh*

Hi, sometime a long time ago somebody showed me how to do what I think
you need to do.  Try the following (I assume you have root privilege):

look for the file /usr/lib/X11/system.mwmrc

Within it (near the top) you'll find a section similar to what mine
looks like:

#
# menu pane descriptions
#

# Root Menu Description
Menu RootMenu
{
    "Root Menu"		f.title
    no-label		f.separator
    "New Window"	f.exec "aixterm &"
    "Shuffle Up"	f.circle_up
    "Shuffle Down"	f.circle_down
    "Refresh"		f.refresh
    no-label		f.separator
    "Restart..."	f.restart
    "Quit"		f.quit_mwm
}

[ rest of file deleted ]

Where you probably need to add that last line "Quit"  f.quit_mwm


-Ivan Maldonado

--
 ------------------------------------------------------------------------
 | Guillermo Ivan Maldonado        |  Internet: ivan@nepjt.ncsu.edu    |
 | Dept. of Nuclear Engineering    |  BITNET  : maldonado@ncsune       |
 | North Carolina State University |-------------------------------------
 | NCSU Box # 7909                 |   ... que viva el ECUADOR!!       |
 | Raleigh. NC 27695-7909          |     ..How many jobs ya' got MON!? |
 ------------------------------------------------------------------------

mikebe@austin.itx.isc.com (Michael G. Beirne) (03/26/91)

In article <KQPFH0S@linac.fnal.gov> looi@sutro.SFSU.EDU (W. W. Looi) writes:
>  Path: ism.isc.com!ispd-newsserver!rpi!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!linac!daemon
>  From: looi@sutro.SFSU.EDU (W. W. Looi)
>  Newsgroups: comp.unix.aix
>  Date: 25 Mar 91 04:33:11 GMT
>  Organization: San Francisco State University
>  I'm new to AIX environment. I wonder if there is a way to "elegantly"
>  exit from mwm and return to either login or console screen without
>  resorting to CTRL-ALT-Backspace? I was told that "xstop" will do the
>  job, but I don't seem to be able to locate it. Worst yet, it's not
>  documented anywhere in the manual. *sigh*

Copy /usr/lib/X11/system.mwmrc to your home directory and rename it
.mwmrc. Then add the "Stop X" line to the Root menu and the menu
StopX.
--------------------------------------------------------------
# Root Menu Description
Menu RootMenu
{
    "Root Menu"		f.title
    ....(missing lines)
    "Restart..."	f.restart
    "Stop MWM"		f.quit_mwm
    "Stop X"		f.menu StopX
}

Menu StopX
{
  "Stop the X Server?"					f.title
  "No, don't kill the X Server"				f.beep
  "Yes, I want to stop X and kill all X clients!"	f.exec "kill $XSERVERPID"
}
-------------------------------------------------------------------------
Then in $HOME/.xinitrc add the following line:

XSERVERPID=`ps -ef|grep '/X '|grep rgb |awk '{print $2}';export XSERVERPID

This makes several assumptions:
  a) The X servers name is "X"
  b) It has the argument "rgb" to it. (you are on a color system)
	"grep '/X ' matches itself from the ps. The second grep deletes
	this and then there is only one line passed to awk
  c) There is only one X server running on the system.

This works for me on a RS6000 part number 7013(model 530).
It will slow up your X startup a bit.

Another way might be to startup X with the command:
open xinit

Then when you type ALT+Ctrl/Act the console window will become active
again and you can kill off X from this window.
I haven't tested this yet, but it should work.

Michael G. Beirne
mikebe@i88.isc.com

jcburt@ipsun.larc.nasa.gov (John Burton) (03/26/91)

In article <IVAN%NEPJT.91Mar25152931@nepjt.ncsuvx.ncsu.edu> ivan@nepjt.ncsu.edu (Ivan Maldonado) writes:
>In article <KQPFH0S@linac.fnal.gov> looi@sutro.SFSU.EDU (W. W. Looi) writes:
>> I'm new to AIX environment. I wonder if there is a way to "elegantly"
>> exit from mwm and return to either login or console screen without
>> resorting to CTRL-ALT-Backspace? I was told that "xstop" will do the
>> job, but I don't seem to be able to locate it. Worst yet, it's not
>> documented anywhere in the manual. *sigh*
>
>Hi, sometime a long time ago somebody showed me how to do what I think
>you need to do.  Try the following (I assume you have root privilege):
>
>look for the file /usr/lib/X11/system.mwmrc
>
>Within it (near the top) you'll find a section similar to what mine
>looks like:
>
>#
># menu pane descriptions
>#
>
># Root Menu Description
>Menu RootMenu
>{
>    "Root Menu"		f.title
>    no-label		f.separator
>    "New Window"	f.exec "aixterm &"
>    "Shuffle Up"	f.circle_up
>    "Shuffle Down"	f.circle_down
>    "Refresh"		f.refresh
>    no-label		f.separator
>    "Restart..."	f.restart
>    "Quit"		f.quit_mwm
>}
>
>[ rest of file deleted ]
>
>Where you probably need to add that last line "Quit"  f.quit_mwm
>
>
>-Ivan Maldonado

Ivan,
  I originally thought that would work also, unfortunately f.quit_mwm
only stops the window manager...you're still in X-windows, you just don't
have MWM running anymore. I think what the orignal poster wants is something
that does the same thing as the CTRL-ALT-BACKSPACE combination. If f.quit_mwm
DOES do that for you, how do you have it set up? (are you disabling CTRL-etc
exit when you start X-windows?).

Also, Instead of bothering with the system.mwmrc, just have your own copy 
in your root directory (mwm looks for a $HOME/.mwmrc file for initialization)

So, does anyone know of a way to get out of X-windows *without* using
CTRL-ALT-BACKSPACE ? (i.e. a way that can be setup as a menu item...
I KNOW you can do it with OTHER window managers (TWM)...

+--------------------------------------------------------------------+
| John Burton                                                        |
| G & A Technical Software                                           |
| jcburt@gatsibm.larc.nasa.gov                                       |
| jcburt@cs.wm.edu                                                   |
|                                                                    |
| Disclaimer: Hey, what can I say...These are *my* views, not those  |
|             of anyone else, be they employer, school, or government|
+--------------------------------------------------------------------+

boote@bierstadt.scd.ucar.edu (Jeff W. Boote) (03/27/91)

> So, does anyone know of a way to get out of X-windows *without* using
> CTRL-ALT-BACKSPACE ? (i.e. a way that can be setup as a menu item...
> I KNOW you can do it with OTHER window managers (TWM)...

This has nothing to do with the window manager!  The window manager is
just an X-client like any other with a few extra permissions.  The answer
to the original poster is two-fold.  First, you must disable the ability
to kill X using CTRL-ALT-BS.  This is done using the -T option to xinit
when you start up X.  
ie. /usr/bin/X11/xinit -T

The second part of the problem is to kill X when you exit.  There are
many ways you can do this.  The first thing you need to decide is when
is it reasonable to quit X, when the window manager exits? when some
other window exits?  On most systems the user is given a window that
is called the console or login window.  On these systems X is killed
when the user log's off of that window.  That is the methode I have
used.  To do this on AIX 3.1 you must copy the file
/usr/lpp/X11/defaults/xinitrc
into your home directory as .xinitrc
This script will be executed from the xinit command.  This is the same
place you would add in any clients you want automatically started every
time you start X.  The default script starts up an aixterm, xclock and
the adobe postscrit copywrite.  You can change these to any clients you
want.  The key to getting X to exit is how you call xinit and how you
enter the clients in this file.  The easiest way to get X to automatically
exit is by using the "open" command to execute xinit.  
ie. open /usr/bin/X11/xinit -T
What this will do is to open a virtual terminal that will stay open until 
the xinitrc script finishes executing.  Therefore since the last line
of the default xinitrc file is "exec mwm" that virtual terminal will remain
open untill mwm exits.  What I have done so that I can start up different
window managers without killing X is to replace that line with 
mwm&
and then I start up an xterm in its place.
exec xterm -n Console -T Console
Therefore when I logout of that window all of X is killed.

Hope this helps, 
jeff
-- 
Jeff W. Boote  <boote@ncar.ucar.edu>      *********************************
Scientific Computing Division             * There is nothing good or bad  *
National Center for Atmospheric Reasearch * but thinking makes it so.     *
Boulder                                   *                   Hamlet      *
                                          *********************************

ivan%nepjt@ncsuvx.ncsu.edu (Ivan Maldonado) (03/27/91)

In article <1991Mar26.134746.2573@news.larc.nasa.gov> 
jcburt@ipsun.larc.nasa.gov (John Burton) writes:
> From: jcburt@ipsun.larc.nasa.gov (John Burton)
> Newsgroups: comp.unix.aix
> Date: 26 Mar 91 13:47:46 GMT
> References: <KQPFH0S@linac.fnal.gov> <IVAN%NEPJT.91Mar25152931@nepjt.ncsuvx.ncsu.edu>
> Sender: news@news.larc.nasa.gov (USENET Network News)
> Organization: NASA Langley Research Center, Hampton, VA  USA
> Lines: 65

> In article <IVAN%NEPJT.91Mar25152931@nepjt.ncsuvx.ncsu.edu> 
> ivan@nepjt.ncsu.edu (Ivan Maldonado) writes:
> >>In article <KQPFH0S@linac.fnal.gov> 
> >>looi@sutro.SFSU.EDU (W. W. Looi) writes:
> >> I'm new to AIX environment. I wonder if there is a way to "elegantly"
> >> exit from mwm and return to either login or console screen without
> >> resorting to CTRL-ALT-Backspace? I was told that "xstop" will do the
> >> job, but I don't seem to be able to locate it. Worst yet, it's not
> >> documented anywhere in the manual. *sigh*
> >
> >Hi, sometime a long time ago somebody showed me how to do what I think
> >you need to do.  Try the following (I assume you have root privilege):
> >
> >look for the file /usr/lib/X11/system.mwmrc
> >

Or as others suggested make your own personal copy $HOME/.mwmrc.

> >Within it (near the top) you'll find a section similar to what mine
> >looks like:
> >
> >#
> ># menu pane descriptions
> >#
> >
> ># Root Menu Description
> >Menu RootMenu
> >{
> >    "Root Menu"		f.title
> >    no-label		f.separator
> >    "New Window"	f.exec "aixterm &"
> >    "Shuffle Up"	f.circle_up
> >    "Shuffle Down"	f.circle_down
> >    "Refresh"		f.refresh
> >    no-label		f.separator
> >    "Restart..."	f.restart
> >    "Quit"		f.quit_mwm
> >}
> >
> >[ rest of file deleted ]
> >
> >Where you probably need to add that last line "Quit"  f.quit_mwm
> >
> >-Ivan Maldonado

> Ivan,
>   I originally thought that would work also, unfortunately f.quit_mwm
> only stops the window manager...you're still in X-windows, you just don't
> have MWM running anymore. I think what the orignal poster wants is something
> that does the same thing as the CTRL-ALT-BACKSPACE combination. If f.quit_mwm
> DOES do that for you, how do you have it set up? (are you disabling CTRL-etc
> exit when you start X-windows?).
:
> So, does anyone know of a way to get out of X-windows *without* using
> CTRL-ALT-BACKSPACE ? (i.e. a way that can be setup as a menu item...
> I KNOW you can do it with OTHER window managers (TWM)...
:
> | John Burton                                                        |

John & Others,

The above procedure will work so long you start "X" through the command:

open xinit

This supposedly sets all the "X" processes under the parent process
"mwm", so that the "f.quit_mwm" step will kill all its "X" babies.
It works just fine on our risc's..

-Ivan

--
 ------------------------------------------------------------------------
 | Guillermo Ivan Maldonado        |  Internet: ivan@nepjt.ncsu.edu    |
 | Dept. of Nuclear Engineering    |  BITNET  : maldonado@ncsune       |
 | North Carolina State University |-------------------------------------
 | NCSU Box # 7909                 |   ... que viva el ECUADOR!!       |
 | Raleigh. NC 27695-7909          |     ..How many jobs ya' got MON!? |
 ------------------------------------------------------------------------

ghe@physics.orst.edu (Guangliang He) (03/27/91)

In article <IVAN%NEPJT.91Mar26164323@nepjt.ncsuvx.ncsu.edu>, ivan%nepjt@ncsuvx.ncsu.edu (Ivan Maldonado) writes:
|> 
|> John & Others,
|> 
|> The above procedure will work so long you start "X" through the command:
|> 
|> open xinit
|> 
|> This supposedly sets all the "X" processes under the parent process
|> "mwm", so that the "f.quit_mwm" step will kill all its "X" babies.
|> It works just fine on our risc's..
|> 
|> -Ivan
|> 

But 'open' doesn't work on X-Stations. It complaints that /dev/pts/?
is not the console or an hft workstation, although the man page says
nothing about 'open' works only on console. 

Guangliang He
ghe@physics.orst.edu

jcburt@ipsun.larc.nasa.gov (John Burton) (03/27/91)

In article <10776@ncar.ucar.edu> boote@bierstadt.scd.ucar.edu (Jeff W. Boote) writes:
>> So, does anyone know of a way to get out of X-windows *without* using
>> CTRL-ALT-BACKSPACE ? (i.e. a way that can be setup as a menu item...
>> I KNOW you can do it with OTHER window managers (TWM)...
>
>This has nothing to do with the window manager!  The window manager is
>just an X-client like any other with a few extra permissions.  The answer
>to the original poster is two-fold.  First, you must disable the ability
>to kill X using CTRL-ALT-BS.  This is done using the -T option to xinit
>when you start up X.  
>ie. /usr/bin/X11/xinit -T
>
> [much info on mwm and .xinitrc deleted]
>
>Hope this helps, 
>jeff
>-- 
>Jeff W. Boote  <boote@ncar.ucar.edu>      *********************************
>Scientific Computing Division             * There is nothing good or bad  *
>National Center for Atmospheric Reasearch * but thinking makes it so.     *
>Boulder                                   *                   Hamlet      *
>                                          *********************************

Thanks so much for the info...I got several replies saying about the same thing...
1) Start xinit using open
2) Remove the "exec" from the "exec mwm" in my .xinitrc

This works fine, (I did *not* have to disable the CTRL-ALT-BS to get it to
work) basically I'm using an menu option to quit mwm and that takes me out
of X-windows (I'm *still* learning to deal with X-windows, just started using
it a couple of months ago). You discussion reminded me of another question/problem
I have...Currently, with my setup (a couple of aixterms open, mwm is the last
line in my .xinitrc file), any messages sent to the console (requests for "talk",
system errors, etc) wind up in bit heaven (who knows where it goes). What I'd like
to do is redirect these messages to a "console" window, such as Contool does on
a Sun system with X-windows. I tried compiling the comp.sources.x version of 
contool, but it was unable to get the console output (I forget the actual error
message I got, but basically it implied that it couldn't obtain control of the
console output). Your disscusion mentioned placing an xterm as the last line of
my .xinitrc file, would this redirect console I/O to that xterm? Unfortunately,
I would like my cake and be able to eat it too, How would I be able to A) shutdown
MWM via a menu option (mwm as last line in .xinitrc) and B) capture the console
I/O (xterm as last line in .xinitrc ?) ? suggestions?

Thanks for the time (and bandwidth)

+--------------------------------------------------------------------+
| John Burton                                                        |
| G & A Technical Software                                           |
| jcburt@gatsibm.larc.nasa.gov                                       |
| jcburt@cs.wm.edu                                                   |
|                                                                    |
| Disclaimer: Hey, what can I say...These are *my* views, not those  |
|             of anyone else, be they employer, school, or government|
+--------------------------------------------------------------------+

geo@george.austin.ibm.com (George Noren) (03/27/91)

In article <1991Mar27.040855.24883@lynx.CS.ORST.EDU>,
ghe@physics.orst.edu (Guangliang He) writes:
> 
> In article <IVAN%NEPJT.91Mar26164323@nepjt.ncsuvx.ncsu.edu>,
ivan%nepjt@ncsuvx.ncsu.edu (Ivan Maldonado) writes:
> |> 
> |> John & Others,
> |> 
> |> The above procedure will work so long you start "X" through the command:
> |> 
> |> open xinit
> |> 
> |> This supposedly sets all the "X" processes under the parent process
> |> "mwm", so that the "f.quit_mwm" step will kill all its "X" babies.
> |> It works just fine on our risc's..
> |> 
> |> -Ivan
> |> 
> 
> But 'open' doesn't work on X-Stations. It complaints that /dev/pts/?
> is not the console or an hft workstation, although the man page says
> nothing about 'open' works only on console. 
> 
> Guangliang He
> ghe@physics.orst.edu

Xstations should not be a problem with this discussion.  When you 
"exit" from the login window on an Xstation, it kills mwm and returns
you to the Xserver that is running on the Xstation with a login window
to your boot machine. To kill the Xserver on the Xstation, turn it off 
(power off). The Xstation exists only to run the Xserver, so killing
the Xserver on the Xstation doesn't seem to make sense.

BTW in one of your previous appends about /tmp files - The *.pag files are
there for each Xstation that you have running (where * is some 8 digit number
that is unique to the Xstation).  They serve as a sort of "paging space" for
the Xstation. They go away when you turn off the associated Xstation.

Sincerely,
George Noren

+-------------------------+--------------------------------+----------------+
|AWD Early Systems Support| AIX : geo@george.austin.ibm.com|PH: 512/838-4930|
|IBM Austin - Zip 2830    | VNET: GEORGE at AUSVMQ         |TL: 678-4930    |
+-------------------------+--------------------------------+----------------+

sanders@peyote.cactus.org (Tony Sanders) (03/28/91)

To redirect console output use "swcons" (See also lscons).

-- sanders

geo@george.austin.ibm.com (George Noren) (03/29/91)

Guangliang He (ghe@physics.orst.edu) sent me email, which I can't reply
to since
I'm not yet plugged into email services for internet.  I can only post
(alas...).

I had said:  
  |> Xstations should not be a problem with this discussion.  When you 
  |> "exit" from the login window on an Xstation, it kills mwm and returns
  |> you to the Xserver that is running on the Xstation with a login window
  |> to your boot machine.

He responded:
  >> This is certainly not the case on our X-Stations. When I logout from
  >> the login window, the mwm is killed and the login window is closed.
  >> But if I have other windows open at that time, those windows get
  >> frozen, and the X-station hangs. I have to Ctrl-Alt-Backspace to
  >> reboot the X-station. I called our SE and he came up with a
  >> unacceptable solution called 'soft-reboot' which kills every processes
  >> I own (Including my login on other terminals, console, ...). I don't
  >> know what's wrong on our X-station. 

Well, I tried your scenario on my stuff and sure enough that's what happened.
I don't think your Xstation is broken.  I am just ordered enough in my methods
that I never logged out until all the windows were closed (which I believe is
the behavior that should be encouraged). However, you need to be able to
recover your windows
if you or one of your users accidently logs out (to prevent loss of
data).  This
is what I did when my Xstation (named daneel) locked up as you described:

1. Logged on to the server.
2. Restarted the window manager on the Xstation:

	# DISPLAY=daneel:0 /usr/lpp/X11/bin/mwm &

3. Returned to the Xstation and closed out the windows gracefully.
4. Returned to the server and killed mwm on the Xstation:
	# ps -ef | grep mwm
        root 14517 16034   1 08:49:45  pts/0  0:00 grep mwm 
        root 16305 16034   0 08:49:27  pts/0  0:00 /usr/lpp/X11/bin/mwm 

	# kill 16305
	(kill the process id associated with mwm that was started from this
	hft on the server - you should be able to tell which mwm you just started)

	NOTE: If you don't kill this copy of mwm, the Xstation becomes an open
	port to the login that started mwm (root in my case).  All they have to
	do is select "new window" on the menu, and they are root on the server.
	DON'T LET THIS HAPPEN TO YOU!

5. This puts up a pop-up on the Xstation asking if it's ok to quit. 
Click on OK.
   Your login prompt window returns.

Now, I know this is not terribly convenient for everyday happenings. 
But it works for
blunder-recovery.  I am anticipating using this frequently in the near
future as I am
installing 12 new Xstations for previous PC users. 

Best of luck.

Sincerely,
George Noren

My opinions, of course...
+-------------------------+--------------------------------+----------------+
|AWD Early Systems Support| AIX : geo@george.austin.ibm.com|PH: 512/838-4930|
|IBM Austin - Zip 2830    | VNET: GEORGE at AUSVMQ         |TL: 678-4930    |
+-------------------------+--------------------------------+----------------+

m-hirano@sra.co.jp (03/31/91)

In article <1991Mar27.040855.24883@lynx.CS.ORST.EDU> ghe@physics.orst.edu (Guangliang He) writes:

 >>But 'open' doesn't work on X-Stations. It complaints that /dev/pts/?
 >>is not the console or an hft workstation, although the man page says
 >>nothing about 'open' works only on console. 
 >>
 >>Guangliang He
 >>ghe@physics.orst.edu

Hi. This is from Japan.

My clients don't like type "Alt+Ctrl+BS" and do "xinit" on thier X station, 
I set up xdm for them.

This xdm is in X11R4. IBM Xstation's xserver don't support XDMCP, so I modified 
/usr/lpp/x_st_mgr/bin/x_st_mgrd.cf as send HUP signal to xdm When Xstation boot up.
Off course we need "f.quit_mwm" in ~/.mwmrc and "exec mwm" in ~/.xsession.
It works fine.

If you have X11R4 sources, try this(I believe X11R3 codes are also OK).

Is my english funny ? But I hope you understand what I want to say. :-)

Thank you for reading.

m-hirano@sra.co.jp
Software Research Associates,Inc., Japan.
--

  ****************************************************************************
  ($@3t(J)$@#S#R#A(J					$@J?Ln(J  $@4p9'(J
  $@%o!<%/%9%F!<%7%g%s#S#I5;=QIt(J			TEL:	03-234-2654
  						$@Fb@~(J:	4310
  $@El5~ET@iBeED6hJ?2OD.#1!]#1!]#1(J		E-Mail:	m-hirano@sra.co.jp
  ****************************************************************************