On Tue, 4 Sep 2001, Burt Bicksler wrote:

> Hi,
>
> I have rotation support working with XFree86 including coordination of
> display rotation and touch screen driver rotation.  That all is working
> very well, but we of course need to exit X and restart it for the new
> rotation to take effect.
>
> This is fine for the initial deployment, but there is a requirement to have
> a button that kicks off a script that will kill off X and then restart it.
>
> I have the restarting working just fine, but wondered if there was a safe,
> reliable way to kill X from a script?
>
> Is there anything other than greping the output of ps, extracting the
> process ID for X and passing that to kill? If not, is there an example
> script somewhere that you could point me to?

    You want to make sure you kill the right X server, if more than
one is running on the machine.

perl -e '
    ($pid, $ppid) = `ps axl -Ouser | grep X | grep \`whoami\` | awk '{ print $2 $3 }'`;
    print "$pid\n";
'

    That won't work on Solaris, but should work on Linux and FreeBSD.
Making it actually work is an exercise for the reader (you may have to
play with the quoting a bit, and no doubt there's a much better way to
do that in Perl than what I've shown).

-- 
Chris BeHanna
Software Engineer                   (Remove "bogus" before responding.)
[EMAIL PROTECTED]
I was raised by a pack of wild corn dogs.

_______________________________________________
Xpert mailing list
[EMAIL PROTECTED]
http://XFree86.Org/mailman/listinfo/xpert

Reply via email to