As you spotted john my killing loop was killing the system V script itself also hence it never starting my_app again, so instead a simple if skips the process ID of the system V script itself so it can continue on to start my_app again:


>       I'd think that the pgrep is matching both the processes you want
>       to kill _and_ the init.d script itself. 
 
My script looks like the following:


restart)
echo "Stopping my_app:"
pgrep my_app | while read PIDS
do
        if [ "$PIDS" -eq $$ ]; then
                continue
        fi
        kill -9 $PIDS
done
echo "Starting my_app:"
/etc/init.d/my_app start &
exit $?
;;

Thanks for the help everyone its greatly appreciated.

Regards,
James ;)
 

-----BEGIN GEEK CODE BLOCK-----
 Version: 3.1
GIT/MU/U dpu s: a--> C++>$ U+> L++> B-> P+> E?> W+++>$ N K W++ O M++>$ V-
PS+++ PE++ Y+ PGP t 5 X+ R- tv+ b+> DI D+++ G+ e(+++++) h--(++) r++ z++
------END GEEK CODE BLOCK------