1831469 Members
3480 Online
110025 Solutions
New Discussion

Re: script wanted

 
peterchu
Super Advisor

script wanted

I want to have a script that to kill the processes that the process name are "orcpro" ( by checking with ps -ef |grep orcpro " and these process are idle for over 35 minutes , could help to suggest the script ? thx in advance .
2 REPLIES 2
Nick Wickens
Respected Contributor

Re: script wanted

Try something like this ? I just dragged this out of something I have running to send an email alert rather than kill so you will need to incorporate some kill stuff where indicated.

LONG=35
for TIME in $(ps -ef|grep orcpro |grep -v grep|tr -s " " |cut -d" " -f8|cut -d":
" -f1)
do
integer x=$TIME
if [ $x -gt $LONG ];then

kill stuff here
done
Hats ? We don't need no stinkin' hats !!
Nick Wickens
Respected Contributor

Re: script wanted

Just realised that my script checks for processes that have been running for 35 minutes rather than idle so amend as appropriate.
Hats ? We don't need no stinkin' hats !!