svc

Simple service scripts and examples, to be used everywhere.
git clone git://r-36.net/svc
Log | Files | Refs | README | LICENSE

barebone (311B)


      1 #!/bin/sh
      2 
      3 SERVICE="barebone"
      4 
      5 [ -e "/bin/svc.d/default/$SERVICE" ] && . "/bin/svc.d/default/$SERVICE"
      6 
      7 BIN="/usr/bin/$SERVICE"
      8 
      9 PID=$(pidof -o %PPID $BIN)
     10 
     11 case $1 in
     12 	-s)
     13 		[ -z "$PID" ] && $BIN $PARAMS;
     14 		;;
     15 	-k)
     16 		[ -n "$PID" ] && kill -9 $PID &> /dev/null;
     17 		;;
     18 	*)
     19 		echo "usage: $0 -s|-k"
     20 		exit 1
     21 esac
     22