Iniciar / parar / ciclo de status para o programa vert.x (ou qualquer outro controlado por PID)

Este é um pequeno script Shell para controlar qualquer programa que pode ser interrompido eliminando seu processo.

#!/bin/sh
SERVICEPID
="service.pid"
case $1 in
"start")
if [ ! -f $SERVICEPID ]; then
EXPR
="vertx runmod com.m4s~dingus-ws~1.0.0 &> log/system.out &"
eval $EXPR
pid
=$!
echo $pid
> $SERVICEPID
echo
"Service Started with PID: $pid"
else
echo
"$SERVICEPID Exist!, Check if the program is not running already."
fi
;;
"stop")
if [ -f $SERVICEPID ]; then
pid
=$(<"$SERVICEPID")
kill
-9 $pid
rm
-f $SERVICEPID
echo
"Servicewith PID: $pid. Stoped "
else
echo
"$SERVICEPID DON'T Exist!, Check if the program is not halted already."
fi
;;
"status")
if [ ! -f $SERVICEPID ]; then
echo
"$SERVICEPID DON'T Exist!, Check if the program is not halted already."
else
pid
=$(<"$SERVICEPID")
ps $pid

fi
;;
*)
echo
"please use:"
echo
" start | stop | status"
;;
esac