php fpm start.sh

#! /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                                                                                                                                               
                               

 

posted @ 2015-08-27 19:55  hao.ma  阅读(177)  评论(0编辑  收藏  举报