天天看點

case 制做http啟動檔案

[-f /etc/rc.d/init.d/functions ] && . /etc/rc.d/init.d/functions

RETVAL=0

httpd="/application/apache/bin/httpd"

start(){

        $httpd -k start >/dev/null2>&1

        RETVAL=$?

[$RETVAL -eq 0 ] && action "starthttpd:" /bin/true ||\

action"starthttpd:" /bin/false

return$RETVAL

}

stop(){

        $httpd -k stop >/dev/null2>&1

        [$? -eq0 ]&& action "stophttpd:" /bin/true ||\

action"stophttpd:" /bin/false

case"$1" in

start)

start

                ;;

stop)

stop

        ;;

restart)

sh$0 stop

sh$0 start

    #[! -x "$0"] &&chmod +x $0

    #$0 stop

    #$0 start

   *)

echo"Format error!"

echo$"Usage: $0 {start|stop|restart}"

exit1

esac

exit$RETVALL

繼續閱讀