[Shell] 纯文本查看 复制代码 #! /bin/bash
# Startup script for the Nginx HTTP Server
# chkconfig: - 85 15
# description: Startup script for the Nginx HTTP Server
# processname: tengine
# pidfile: /opt/tengine/run/nginx.pid
# config: /opt/tengine/conf/tengine.conf
tengine=/opt/tengine/sbin/nginx
tengine_config=/opt/tengine/conf/nginx.conf
tengine_pid=/opt/tengine/run/nginx.pid
RETVAL=0
prog="nginx"
# Source function library.
. /etc/init.d/functions
# Source networking configuration.
. /etc/sysconfig/network
# Check that networking is up.
[ ${NETWORKING} = "no" ] && exit 0
[ -x $tengined ] || exit 0
# Start tengine daemons functions.
start() {
if [ -e $tengine_pid ];then
echo "tengine already running...."
exit 1
fi
echo -n "Starting $prog: "
daemon $tengine -c ${tengine_config}
RETVAL=$?
echo
[ $RETVAL = 0 ] && touch /var/lock/subsys/tengine
return $RETVAL
}
# Stop tengine daemons functions.
stop() {
echo -n "Stopping $prog: "
killproc $tengine
RETVAL=$?
echo
[ $RETVAL = 0 ] && rm -f /var/lock/subsys/tengine $tengine_pid
}
# reload tengine service functions.
reload() {
echo -n "Reloading $prog: "
killproc $tengine -HUP
RETVAL=$?
echo
[ $RETVAL = 0 ]
}
# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
reload)
reload
;;
restart)
stop
start
;;
status)
status $prog
RETVAL=$?
;;
*)
echo "Usage: $prog {start|stop|restart|reload|status|help}"
exit 1
esac
exit $RETVAL |