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?
I put your script in hourold.sh and greped stashd what's teletype syntax error on line 1 mean?
user@host:/export/home/user/--> hourold.sh |grep 'stashd'
syntax error on line 1, teletype
syntax error on line 1, teletype
syntax error on line 1, teletype
21931 /opt/ft/st414/bin/agents/stashd
222 /opt/ft/st414/bin/agents/stashd
syntax error on line 1, teletype
syntax error on line 1, teletype
syntax error on line 1, teletype
syntax error on line 1, teletype
syntax error on line 1, teletype
syntax error on line 1, teletype
syntax error on line 1, teletype
syntax error on line 1, teletype
syntax error on line 1, teletype
syntax error on line 1, teletype
syntax error on line 1, teletype
syntax error on line 1, teletype
syntax error on line 1, teletype
syntax error on line 1, teletype
syntax error on line 1, teletype
syntax error on line 1, teletype
syntax error on line 1, teletype
syntax error on line 1, teletype
syntax error on line 1, teletype
syntax error on line 1, teletype
syntax error on line 1, teletype
user@host:/export/home/user/-->
I did this it scrolls off the page and seems to work. I guess the problem I have is when I pipe the script out put through a grep to get the stashd process only?