[comp.windows.x] Can X die with no fuss?

ckeane@ultima.cs.uts.oz (Chris Keane) (07/20/89)

Our site runs a net of Suns (mainly 3/50's) and I like to use both
SunView and X at different times. The Problem is that while SunView
can be killed with no problem, X doesnt seem to have a shut-down 
option, and when the relevant processes are killed, it tends to do
*strange* things to the workstation. Does any know of any graceful
way of terminating X without re-booting?
regards...
                                           (void *) Chris();

-----
This has been a message from Robin the Hood and his band of Merry Hackers.
------------------------+(The UTS Programmers' Society)
zeus@utscsd.oz		| UTS: The University at the End of The Universe.
cmkeane@utscsd.oz	|
ckeane@ultima.cs.uts.oz | "I wonder how well a Sun Workstation flies?"
------------------------+

brsmith@umn-cs.CS.UMN.EDU (Brian R. Smith) (07/24/89)

>Path: sunaus!metro!basser!ultima!ckeane

My mailer claims no knowledge of any of those uucp sites...

>Our site runs a net of Suns (mainly 3/50's) and I like to use both
>SunView and X at different times. The Problem is that while SunView
>can be killed with no problem, X doesnt seem to have a shut-down 
>option, and when the relevant processes are killed, it tends to do
>*strange* things to the workstation. Does any know of any graceful
>way of terminating X without re-booting?
>regards...

It sounds like the keyboard state problem that pops up whenever the
server crashes.  It confused me for a while, too.  Check out the
source directory for the Sun server - there is a little program
called "kbd_mode".  You just need to make sure that a "kbd_mode -a"
gets executed after the server exits.  If the server exits gracefully,
it's redundant, but when it crashes...

Make a script that is basically:
#! /bin/sh
xinit
kbd_mode -a

Use that to start X.  Should do it, if that *IS* the problem you're
having.

Brian
brsmith@umn-cs.cs.umn.edu

hadley@ics.uci.edu (T.S. Hadley) (07/25/89)

In article <8907240829.AA03112@sunaus.sun.oz> swoodhead@SUN.COM (Simon Woodhead) writes:
>Our site runs a net of Suns (mainly 3/50's) and I like to use both
>SunView and X at different times. The Problem is that while SunView
>can be killed with no problem, X doesnt seem to have a shut-down 
>option, and when the relevant processes are killed, it tends to do
>*strange* things to the workstation. Does any know of any graceful
>way of terminating X without re-booting?
>regards...
>                                           (void *) Chris();
   
   Here's a method I use to get a quiet, peaceful death from X and
   a usable keyboard afterwards:

      1). I alias my xinit to "xinit .xstartup ; kbd_mode -a".
   
   kbd_mode was described in previous follow-up. Makes sure keyboard
   isn't left in weird state.
   .xstartup is my shell script to start up various windows.

      2). My shell script ".xstartup" is structured thus:

   #!/bin/sh
   (
      xterm &
      xterm &
      ..
      exec xterm -C -n "CONSOLE" 
   ) 2>/dev/null 1>/dev/null

   The stdout & stderr are piped to /dev/null so that when Xsun dies 
   (my 3rd point) no needless error messages are seen.
   (No doubt, sh/unix wizards can find a better way to do this..)

   NOTE: You should make sure everything in the shell script works
   correctly before you discard the output or you will never know
   why a particular X application didn't start.

   One disadvantage is that you won't get any error messages from window
   manager spawned processes that would normally show up in your
   xterm -C shell.


      3). When I want to exit X I explicitly send a "kill -INT"
      to the `Xsun' process number. I have a shell script
      called `killbyname' which kills processes by name 
      (by `awk'ing the ps output), so:
	 "killbyname -INT Xsun".
   

   98 times out of 100 (more or less) when I exit X it works correctly: 
   X applications quietly terminate and, shortly, I get my prompt back
   ready for SunView or X. Once in a while something goes wrong
   and weird things happen (as you described) but not often.

   Disclaimer:
      
      Sure its a kludge, but at least it exits as nicely as SunView.
--
Tedd Hadley (hadley@ics.uci.edu)

swoodhead@SUN.COM (Simon Woodhead) (07/25/89)

Please reply direct to Chris Keane at the address below, or to the
comp.windows.x newsgroup / xpert mailing list.

----- Begin Included Message -----

Path: sunaus!metro!basser!ultima!ckeane
Newsgroups: comp.windows.x
Subject: Can X die with no fuss?
Organization: Comp Sci, NSWIT, Australia


Our site runs a net of Suns (mainly 3/50's) and I like to use both
SunView and X at different times. The Problem is that while SunView
can be killed with no problem, X doesnt seem to have a shut-down 
option, and when the relevant processes are killed, it tends to do
*strange* things to the workstation. Does any know of any graceful
way of terminating X without re-booting?
regards...
                                           (void *) Chris();

-----
This has been a message from Robin the Hood and his band of Merry Hackers.
------------------------+(The UTS Programmers' Society)
zeus@utscsd.oz		| UTS: The University at the End of The Universe.
cmkeane@utscsd.oz	|
ckeane@ultima.cs.uts.oz | "I wonder how well a Sun Workstation flies?"
------------------------+


----- End Included Message -----

lee@sed170.HAC.COM (John Lee ) (07/27/89)

In article <13004@ultima.cs.uts.oz> ckeane@ultima.cs.uts.oz (Chris Keane) writes:
<Our site runs a net of Suns (mainly 3/50's) and I like to use both
<SunView and X at different times. The Problem is that while SunView
<can be killed with no problem, X doesnt seem to have a shut-down 
<option, and when the relevant processes are killed, it tends to do
<*strange* things to the workstation. Does any know of any graceful
<way of terminating X without re-booting?
<regards...
<                                           (void *) Chris();
<-----
<This has been a message from Robin the Hood and his band of Merry Hackers.
<------------------------+(The UTS Programmers' Society)
<zeus@utscsd.oz		| UTS: The University at the End of The Universe.
<cmkeane@utscsd.oz	|
<ckeane@ultima.cs.uts.oz | "I wonder how well a Sun Workstation flies?"
<------------------------+

Funny, our site is running a Sun cluster with 3/50's and we switch between
SunView and X11R2 all the time.  The clients are set up with the default of
no window system at log-in, and the user executes xinit or suntools to bring
up the window system of choice.  X seems to exit just fine (by exiting out
of the console window) and I can switch between the two systems without any
problems.  I'm sure we have the plain-vanilla MIT distribution.  Has your
version been customized strangely in some way?

--John Lee
-------------------------------------------------------------------------------
Raining CATS and DOGS?  Join the RATS: Remote Amiga Teleconferencing System
	+--------+			John Lee
	| HUGHES |
	+--------+			ARPAnet: jhlee@hac2arpa.hac.com	
	Hughes Aircraft Company
The above opinions are those of the user and not of those of this machine.

richard@torch.UUCP (Richard Nuttall) (08/02/89)

In article <8907240829.AA03112@sunaus.sun.oz> swoodhead@SUN.COM (Simon Woodhead) writes:
>Our site runs a net of Suns (mainly 3/50's) and I like to use both
>SunView and X at different times. The Problem is that while SunView
>can be killed with no problem, X doesnt seem to have a shut-down 
>option, and when the relevant processes are killed, it tends to do
>*strange* things to the workstation. Does any know of any graceful
>way of terminating X without re-booting?
>regards...
>                                           (void *) Chris();


In our version of the X server, we suggest use of AWM as the default
window manager. We have a script which causes AWM to be run as the
primary client. AWM can be told to run other clients, such as xterms.

The problem then degenerates to one of killing AWM. This is easy, since
AWM provides it as a standard feature, just configure a popup menu option
that calls the exit function.

Then, hit the EXIT option, and Hey Presto, X exits. Of course, you still
need to clean up the keyboard. Since our server can run on top of and with
Sunview, this is a little more complicated than normal, but still fairly
straightforward.

I hope this helps.

regards,

Richard.

P.S. Our server is available now on all Suns, with all sorts of
optimisations, bug fixes and other goodies. Mail me at address
below for more details.

-- 
Richard Nuttall               |    ukc!stc!datlog!torch!richard
Torch Technology Ltd.         |    richard@torch.co.uk
Cambridge England             |    0223 841000 X 308