svc

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

nscd (449B)


      1 #!/bin/sh
      2 
      3 SERVICE="nscd"
      4 
      5 BIN="/bin/$SERVICE"
      6 
      7 PID=$(pidof -o %PPID $BIN)
      8 
      9 case $1 in
     10 	-s)
     11 		if [ -z $PID ];
     12 		then
     13 			rm -f "/run/$SERVICE.pid" 2>&1 >/dev/null
     14 			mkdir -p /run/nscd /var/db/nscd
     15 			rm -f /run/nscd/* /var/db/nscd/* 2>&1 >/dev/null
     16 
     17 			$BIN $PARAMS >/dev/null 2>&1;
     18 		fi
     19 		;;
     20 	-k)
     21 		if [ -n $PID ];
     22 		then
     23 			nscd -K 2>&1 >/dev/null
     24 			rm -f "/run/$SERVICE.pid" 2>&1 >/dev/null
     25 		fi
     26 		;;
     27 	*)
     28 		echo "usage: $0 -s|-k"
     29 		exit 1
     30 esac
     31