Question : Shell Script

This script i have written to kill the process.But it automatically restarts again.
Tell me whats wrong here:-
#!/bin/bash
pidlist=`ps -eaf | grep -v grep | grep -i exchsim | grep -i sim6 | awk '{print $2}'`

echo $pidlist

for i in `echo $pidlist`
do
        kill -9 $i
done

/bin/mv /app/path/sim6/data/*.* /app/path/sim6/archives/.

Answer : Shell Script

The sintax could be a bit more orderly.
And, as the previous poster said, you got an infinite loop that never breaks. YOu must provide an exit mechanism within the while loop.

while [ $SINGLE -gt 10]
do

nohup exchsim -SIM6>> ${PATHL}/"cout_`date '+%m%d'`.log" 2>&1
     
if [ $SINGLE -lt 10 ]
then
  mv core core.${SINGLE}.$$        
  mv ${PATHF}/data/ExchSim*.log exchsim.${SINGLE}.$$
  echo "`date`: `hostname`: ALERT!!! SIM6 IS  DOWN!!!! Warning ${SINGLE} of 3. Restarting..." | mail ${ALIST}
fi

  SINGLE=`expr $SINGLE + 1`
  sleep 5

  <...here break if SINGLE is equal or greater than 10....>

done
Random Solutions  
 
programming4us programming4us