The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Operating Systems > SUN Solaris
Google UNIX.COM



View Single Post in UNIX Forums - Click on the Thread or Permalink to View Entire Thread -->
  #1 (permalink)  
Old 12-10-2007
xgringo xgringo is offline
Registered User
 

Join Date: Dec 2006
Posts: 28
Kill a particular process if it's over an hour hold

I meant old not hold

I need to kill a process if it's over an hour old and then send an e-mail of the list that was killed.....?

I need to kill ps -ef | grep stashd | grep ' older than an hour?'

#! /bin/bash
if test ps -ef | grep <stashd> (Is over an hour old)???? >>stashd_old.txt

stashd_old=`cat stashd_old.txt`
for i in $stashd_old;
do
kill -9 <stashd>
echo "Found <process_name> older than 1 hour, and killed process name | mail -s "killed <process_name `date`" Jay
fi

done;
etc this stashd process if it's over an hour old?

Last edited by xgringo; 12-10-2007 at 02:33 PM..
Reply With Quote
Remove advertisements
!!
Forum Sponsor