Results 1 to 6 of 6
I need a button that destorys all the VNC sessions on the box.
And thus logs the Entire system off nicely..
Is there a way to do this nicely?
Like:
...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 12-18-2007 #1
Kill Process by name?
I need a button that destorys all the VNC sessions on the box.
And thus logs the Entire system off nicely..
Is there a way to do this nicely?
Like:
orCode:ps aux
and then add some Kill Function behind it?Code:ps -C vnc
Already thanks a lot =)
Cheers,
Robin
- 12-18-2007 #2Linux Guru
- Join Date
- Nov 2004
- Posts
- 6,110
You can just use the killall command. This will look up all PIDs by app name and kill them off.
- 12-18-2007 #3
- 12-18-2007 #4
My 'stop' script still serves a good purpose. It searches for patterns, not just names of processes. So you can kill by user, or any other pattern in the output of <ps aux>. Note! That it's buggy as hell and that it has caused discussing wetter or not it should work in theoretical terms. I keep it as a last resort.
Code:#!/bin/bash # Stop v0.03 if [ ! $1 ] ; then echo "Stop what?" else for i in `ps aux | grep -i $1 | grep -v grep | awk '{print $2}' ` ; do kill -9 $i done exit 0 fi
EDIT: Oh! I thought you said VLC. To kill it if it's not responding. I wouldn't know how a system responds when all VNC sessions receive the kill -9 signal. But it wont end nicely.Can't tell an OS by it's GUI
- 12-18-2007 #5
- 12-19-2007 #6
I did Deploy it now, and it works WONDERFULL!! =)
Thanks a lot... but.. for some reason my PC cant count anymore..
It starts the vnc server now on xvnc:2 instead of 1..
Weird stuff.. And when I try to start with vncserver:1 I get the value returned 127..
Cheers,
Robin


Reply With Quote
