I make two process killing and calling one process
I want to do this repeatedly many time between the interval(sleep)
What will be the command to do this, can you make as one
do use sleep between and run clear the memory(sh sync.sh)
I need your advice,
the script will be like this
killps
sh sync.sh
sleep 30
callps
sleep 60
killps
sh sync.sh
sleep 30
callps
sleep 60
This is callps
#!/bin/sh
pspid=`ps -ef | grep "cap -d" | grep -v grep | awk '{print $2}'`
psmcn=`who am i | awk '{print $6}'`
logfile='/nccbs/bin/ps_reset.log'
if [ "$pspid" -eq "" ]
then
clear
echo " "
echo " " >> $logfile
echo `date '+%Y-%m-%d %H:%M:%S'`' Initialization Started '$psmcn >> $logfile
echo "PS Initializing......."
echo " "
sync.sh
echo `date '+%Y-%m-%d %H:%M:%S'`' PS Started '$psmcn >> $logfile
# /nccbs/bin/xterm -e cap -d
cap -d
sleep 2
echo `date '+%Y-%m-%d %H:%M:%S'`' PS Stopped '$psmcn >> $logfile
echo " " >> $logfile
else
echo
echo
echo Process Already Started...
echo " " >> $logfile
echo `date '+%Y-%m-%d %H:%M:%S'`' Process Already Started...' >> $logfile
echo " " >> $logfile
echo
echo
fi
This is killps
#!/bin/sh
pspid=`ps -ef | grep "cap -d" | grep -v grep | awk '{print $2}'`
psmcn=`who am i | awk '{print $6}'`
logfile='/nccbs/bin/ps_reset.log'
echo
if [ "$pspid" -eq "" ]
then
echo
echo PS is not running
echo `date '+%Y-%m-%d %H:%M:%S '`' PS Not running' >> $logfile
echo
else
# echo Provision PID : $pspid
# echo $psmcn
kill -9 $pspid
kill -9 $pspid
echo `date '+%Y-%m-%d %H:%M:%S '`' PS [ '$pspid' ] Killed '$psmcn >> $logfile
echo Process [ $pspid ] Killed Successfully
fi
echo ; echo