[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [K12OSN] Proccesses not dieing

Try the following script. It kills off every process except root. Don't know how portable it would be to other UNIXes, but I figure it should run fine on *BSD too. When you really mean business, just change "kill $process" to "kill -9 $process". BTW, yes, it's a very quick hack; I'm sure someone could do it w/o dropping a temp file.

********* CUT HERE ***********


# Get a list of all user processes not belonging to root
# store them temporarily in a file called scratchpad.txt
ps ux | grep -v 'root' | awk '{print $2}' > scratchpad.txt

# Kill each process whose pid is in scratchpad.txt
for process in `cat scratchpad.txt`
  kill $process

# Clean up
rm scratchpad.txt

********* CUT HERE ***********

Hope this helps,


Matt wrote:

Got a small problem here.
It seems that after being up for 26 days.. the system has begun to get
sluggish.. apon investigation it appears that there are user proccesses
(mozilla, etc) that are not completely closing out.. even when the user
logs out.. and they are still running in the background. Does anyone
know a way to stop this? Or has anyone written a script to kill
proccesses belonging to users every night that I could run in a cron? Any ideas?

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]