in reply to Re: Start a service, wait 10 seconds, and stop the service.
in thread Start a service, wait 10 seconds, and stop the service.

You're missing the
waitpid $pid, 0;
That's why your processes don't get stopped properly..... Update:
Tried it without the 'waitpid' and exactly as predicted left me with "ghost" processes which I had to kill manually...