This uses the portable ps(1) module from Sunterlib (http://www.scsh.net/resources/sunterlib.html) and is therefore platform independent.
#!/bin/sh
IFS=" "
exec scsh -ll sunterlib-0.4/sunterlib.scm -o pps -o srfi-1 -o threads -s "$0" "$@"
!#
(if (not (= (length (command-line)) 2))
(error (string-append "usage: " (car (command-line)) " service-name")))
(define service-name (cadr (command-line)))
(define all-processes (pps))
(define the-process
(find (lambda (p) (string=? (process-info-executable p) service-name)) all-processes))
(if (not the-process)
(error "did not find matching process"))
(define the-pid (process-info-pid the-process))
(display "Sendig TERM signal to pid ")
(display the-pid)
(newline)
(signal-process the-pid signal/term)
(sleep 3000)
(define all-new-processes (pps))
(if (find (lambda (p) (= (process-info-pid p) the-pid)) all-new-processes)
(begin (display "sending KILL signal...")
(newline)
(signal-process the-pid signal/kill)
(sleep 1000)))
(run (,@(process-info-command-line the-process)))