Re: Killing process with more than one day



On Jun 20, 10:40 am, newhorizon <mehmete...@xxxxxxxxx> wrote:
you can process output of
"ps "
to find the processes ids that are older than one day (you can use
"awk" for that )

then you can kill them :)

but why do you wanna kill the processes older than one day you may
kill system processes as well ?


Thank you, I create this script below :

ps -ef | grep -v grep | grep deport > /tmp/killpr.txt
while read a b c d e f g h i j k l m n o p q r s
do
process=`echo $e | awk '{print length}'`
if [ $process -eq 3 ]
then
echo "$b $e"
kill -9 $b
fi
done < /tmp/killpr.txt
.