In the startup script use a function for getting the process IDs
This greatly simplifies the stop/restart section