Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!rutgers!apple!usc!orion.cf.uci.edu!uci-ics!hadley From: hadley@ics.uci.edu (T.S. Hadley) Newsgroups: comp.windows.x Subject: Re: Can X die with no fuss? Summary: 98% no fuss. Message-ID: <20042@paris.ics.uci.edu> Date: 24 Jul 89 21:11:30 GMT References: <8907240829.AA03112@sunaus.sun.oz> Sender: news@paris.ics.uci.edu Reply-To: T.S. Hadley Organization: University of California, Irvine - Dept of ICS Lines: 59 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)