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.