We have a Gnome session running on our remote server. How can we ssh into the machine and shutdown X-Windows without restarting the machine?
1 Answer
Well, are you trying to just shutdown X because of a locked application and restart it, or do you just want to stop X from running entirely?
Assuming you want to just kill X because of a locked-up application: (examples below are from my OpenSolaris-based server, probably not applicable to Sol8 or 9)
bill@aperture:~# kill -9 2478 bill@aperture:~# ps ac | grep Xorg 2593 vt/2 S 0:00 Xorg bill@aperture:~# kill -9 2593 bill@aperture:~# ps ac | grep Xorg No immediate results, wait a few seconds to run check again bill@aperture:~# ps ac | grep Xorg 2631 vt/2 S 0:00 Xorg
Notice that in this case, X restarted. While this may be good if you're just trying to restart X after a lockup, sometimes you just want to shut GDM off entirely. Check svcs for an entry for GDM.
bill@aperture:~# svcs | grep gdm online 9:10:05 svc:/application/graphical-login/gdm:default
Well, look, I've got an entry for GDM. Thanks to the wonders of SMF, no matter how hard I try, I can't kill X. It keeps coming back from the dead. Let's tell GDM to die-- no, let's just disable it via svcadm.
bill@aperture:~# ps acx | grep gdm 2701 ? S 0:00 gdm-binary 2702 ? S 0:00 gdm-binary 2727 ? S 0:01 gdmgreeter bill@aperture:~# ps acx | grep Xorg 2703 vt/2 S 0:00 Xorg bill@aperture:~# svcadm disable gdm bill@aperture:~# ps acx | grep gdm bill@aperture:~# ps acx | grep Xorg bill@aperture:~#
As a further note, I found this mailing list thread helpful once upon a time, to fix the inability to use Ctrl-Alt-Bksp to kill X on Solaris. Basically, add a few lines to the configuration file for X.org to reenable handling of Ctrl-Alt-Bksp on certain Solaris installs.
-
I want to stop it because I don't want it running on the server. Killing the X-server doesn't seem like the nice way to kill it. I'll try this out tomorrow.– anonOct 23, 2009 at 4:30
-
Well, I hope it helps out. the svcadm disable thing might be what you need. I hope....– Bill BOct 23, 2009 at 17:41