Parameterised the script with start|stop|restart, and got it generating and cleaning up a pidfile (based on service name)