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
.



Relevant Pages

  • Re: Need help on a script
    ... How to pass pid from awk to kill? ... but you may want to search the archives for better alternatives. ...
    (comp.unix.shell)
  • Re: Killing process with more than one day
    ... to find the processes ids that are older than one day (you can use ... "awk" for that) ... but why do you wanna kill the processes older than one day you may ... $f will contain the sixth field and all subsequent fields on each line. ...
    (comp.unix.shell)
  • Re: Killing process with more than one day
    ... to find the processes ids that are older than one day (you can use ... "awk" for that) ... but why do you wanna kill the processes older than one day you may ...
    (comp.unix.shell)
  • Re: Need help on a script
    ... How to pass pid from awk to kill? ... I think you were missing an xargs here. ...
    (comp.unix.shell)
  • Re: FTP in gawk
    ... I dont want to kill your enthusiasm, but I think awk is not best solution for tasks like that. ... Try perl. ...
    (comp.lang.awk)