#! /bin/bash #Source function library. . /etc/init.d/functions #Check that networking is up. . /etc/sysconfig/network if [ "$NETWORKING" = "no" ] then exit 0 fi RETVAL=0 prog="/home/admin/local/php54/sbin/php-fpm" pidfile=${PIDFILE-/home/admin/local/php54/var/run/php-fpm.pid} lockfile=${LOCKFILE-/home/admin/local/php54/var/run/php-fpm.lock} start () { echo -n $"starting $prog: " dir=$(dirname ${pidfile}) [ -d $dir ] || mkdir $dir daemon --pidfile ${pidfile} $prog RETVAL=$? echo [ $RETVAL -eq 0 ] && touch ${lockfile} } stop () { echo -n $"stoping $prog: " killproc -p ${pidfile} $prog RETVAL=$? echo if [ $RETVAL -eq 0 ] then rm -f ${lockfile} ${pidfile} fi } reload() { echo -n $"reloading $prog: " killproc -p ${pidfile} $prog -USR2 RETVAL=$? echo } restart() { stop start } case "$1" in start) start ;; stop) stop ;; status) status -p ${pidfile} $prog RETVAL=$? ;; restart) restart ;; reload) reload ;; *) echo $"usage: $0 {start|stop|status|restart|reload}" RETVAL=2 ;; esac exit $RETVAL