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:<br>
<br><div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div class="im"><br>
> I'd think that the pgrep is matching both the processes you want<br>
> to kill _and_ the init.d script itself. </div></blockquote><div> <br>My script looks like the following:<br><br><br>restart)<br>echo "Stopping my_app:"<br>pgrep my_app | while read PIDS<br>do<br> if [ "$PIDS" -eq $$ ]; then<br>
continue<br> fi<br> kill -9 $PIDS<br>done<br>echo "Starting my_app:"<br>/etc/init.d/my_app start &<br>exit $?<br>;;<br></div><div><br>Thanks for the help everyone its greatly appreciated.<br>
<br>Regards,<br>James ;)<br> </div></div><br>-----BEGIN GEEK CODE BLOCK-----<br> Version: 3.1<br>GIT/MU/U dpu s: a--> C++>$ U+> L++> B-> P+> E?> W+++>$ N K W++ O M++>$ V- <br>PS+++ PE++ Y+ PGP t 5 X+ R- tv+ b+> DI D+++ G+ e(+++++) h--(++) r++ z++<br>
------END GEEK CODE BLOCK------<br>