[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
[K12OSN] Script to Remove Leftover Processes
- From: Charles Hale <support 499pc net>
- To: k12osn redhat com
- Subject: [K12OSN] Script to Remove Leftover Processes
- Date: Thu Dec 4 13:11:08 2003
Nno command line, but a script below will do it for
you. run it nightly. details on how in "man crontab".
#!/bin/bash
#kill old leftover processes - all of them
users=$(awk -F":" '{if ( $3 >= 500 ) print $1}'
/etc/passwd | grep -v -e smb -e ^nfs )
for user in $users
do
#echo $user
processes=$(ps -ef | grep ^"$user " | grep
-e Jan[0-9] -e Feb[0-9] -e Mar[0-9] -e Apr[0-9] -e
May[0-9] -e Jun[0-9] -e Jul[0-9] -e Aug[0-9] -e
Sep[0-9] -e Oct[0-9] -e Nov[0-9] -e Dec[0-9] |awk
'{print $2}')
for process in $processes
do
kill -9 $process
done
done
[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]