I writing a Linux Startup Script to control starting, stopping, restarting a perl daemon script. I have copied the start and stop elements below:
AUTOFTPSCRIPT=/home/ftp/FTPTransfer.pl
case "$1" in
start)
echo -n "Starting FTP Transfer Script: "
$AUTOFTPSCRIPT
touch /var/lock/subsys/FTPTransfer
echo "OK"
;;
stop)
echo -n "Shutdown FTP Transfer Script:"
pResult=`ps aux |grep perl |egrep -v grep |awk '{print $2}'`
echo " "
echo "pResult = $pResult"
echo " "
if [ -n "$pResult" ]
then
kill -15 $pResult
rm -f /var/lock/subsys/FTPTransfer
else
echo "ERROR :- The FTP Transfer was not running previous"
fi
echo "OK"
etc....
The stop element works, however the start element starts the perl script and then kills the perl script on the start-up script exit!
Can anyone suggest anything?
Regards
Brian
AUTOFTPSCRIPT=/home/ftp/FTPTransfer.pl
case "$1" in
start)
echo -n "Starting FTP Transfer Script: "
$AUTOFTPSCRIPT
touch /var/lock/subsys/FTPTransfer
echo "OK"
;;
stop)
echo -n "Shutdown FTP Transfer Script:"
pResult=`ps aux |grep perl |egrep -v grep |awk '{print $2}'`
echo " "
echo "pResult = $pResult"
echo " "
if [ -n "$pResult" ]
then
kill -15 $pResult
rm -f /var/lock/subsys/FTPTransfer
else
echo "ERROR :- The FTP Transfer was not running previous"
fi
echo "OK"
etc....
The stop element works, however the start element starts the perl script and then kills the perl script on the start-up script exit!
Can anyone suggest anything?
Regards
Brian