Thanks for the suggestions. It turns out that starting 'grafana-server ...' ends up starting 'grafana server ...' which made the process name check fail - it expected arg0 to be grafana-server, not grafana.
I've changed the script to start grafana as 'grafana server' instead and it works now. Thomas