#!/bin/sh
# chkconfig: 2345 64 36
# description: A very fast and reliable nginx database engine.
# Comments to support LSB init script conventions
### BEGIN INIT INFO
# Provides: nginx
# Required-Start: $local_fs $network $remote_fs
# Should-Start: ypbind nscd ldap ntpd xntpd
# Required-Stop: $local_fs $network $remote_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: start and stop nginx
# Description: nginx is a very fast and reliable nginx database engine.
### END INIT INFO
. /etc/rc.status
rc_reset
case "$1" in
start)
echo -n "Starting nginx "
su - root -c "cd /usr/local/nginx; sbin/nginx"
rc_status -v
;;
stop)
echo -n "Shutting down nginx "
su - root -c "cd /usr/local/nginx; sbin/nginx -s stop"
rc_status -v
;;
restart)
$0 stop
$0 start
rc_status
;;
status)
id=`lsof -i:9081 | awk '{print $2}'`
if [ -z $id ];then
echo "service unused"
else
echo $id
fi
rc_status -v
;;
*)
echo "Usage: $0 {start|stop|status|restart}"
exit 1
;;
esac
rc_exit