Hi TDATGOD,
Thanks for your awesome reply... Actually I'm new to Unix Shell Scripting.. Can you please clarify me some doubts in ur script.... Sorry if I am disturbing you again..
Doubt 1 :
the following line gives syntax error saying
Error message : if: Expression syntax
Error line : if ( -f cat /tmp/myftppid )
Doubt 2 :
what does this following line do ?
| egrep "myftpscript"
and what does this following loop do ?
@ x ++
if ( $x == 10 ) then
# tried 10 times to kill it and it wouldn't die
echo "Couldn't kill old process"
echo " "
exit 5
Thank you very much.... and below is ur script...
if ( -f cat /tmp/myftppid ) then
set oldpid = `cat /tmp/myftppid`
ps -p $oldpid | egrep "myftpscript" ; set stat = $status
while ( $stat == 0 )
# Last invocation of the script still running....
@ x ++
if ( $x == 10 ) then
# tried 10 times to kill it and it wouldn't die
echo "Couldn't kill old process"
echo " "
exit 5
endif
echo "Old FTP still running "
kill -9 $oldpid
sleep 1
ps -p $oldpid | egrep "myftpscript" ; set stat = $status
end
endif
# put the PID in a file so we can check it next time we start
echo $$ >! /tmp/myftppid
rm -f /tmp/myftppid
Thanks for your awesome reply... Actually I'm new to Unix Shell Scripting.. Can you please clarify me some doubts in ur script.... Sorry if I am disturbing you again..
Doubt 1 :
the following line gives syntax error saying
Error message : if: Expression syntax
Error line : if ( -f cat /tmp/myftppid )
Doubt 2 :
what does this following line do ?
| egrep "myftpscript"
and what does this following loop do ?
@ x ++
if ( $x == 10 ) then
# tried 10 times to kill it and it wouldn't die
echo "Couldn't kill old process"
echo " "
exit 5
Thank you very much.... and below is ur script...
if ( -f cat /tmp/myftppid ) then
set oldpid = `cat /tmp/myftppid`
ps -p $oldpid | egrep "myftpscript" ; set stat = $status
while ( $stat == 0 )
# Last invocation of the script still running....
@ x ++
if ( $x == 10 ) then
# tried 10 times to kill it and it wouldn't die
echo "Couldn't kill old process"
echo " "
exit 5
endif
echo "Old FTP still running "
kill -9 $oldpid
sleep 1
ps -p $oldpid | egrep "myftpscript" ; set stat = $status
end
endif
# put the PID in a file so we can check it next time we start
echo $$ >! /tmp/myftppid
rm -f /tmp/myftppid