- add 'configtest' init command

- change config file test to -f
This commit is contained in:
jjh 2008-05-27 04:06:16 +00:00
parent a31ab4f4be
commit 4fd502bee4

View File

@ -24,13 +24,13 @@ prog=$(basename $nginx)
NGINX_CONF_FILE="/etc/nginx/nginx.conf" NGINX_CONF_FILE="/etc/nginx/nginx.conf"
[ -e /etc/sysconfig/nginx ] && . /etc/sysconfig/nginx [ -f /etc/sysconfig/nginx ] && . /etc/sysconfig/nginx
lockfile=/var/lock/subsys/nginx lockfile=/var/lock/subsys/nginx
start() { start() {
[ -x $nginx ] || exit 5 [ -x $nginx ] || exit 5
[ -f $config ] || exit 6 [ -f $NGINX_CONF_FILE ] || exit 6
echo -n $"Starting $prog: " echo -n $"Starting $prog: "
daemon $nginx -c $NGINX_CONF_FILE daemon $nginx -c $NGINX_CONF_FILE
retval=$? retval=$?
@ -49,11 +49,13 @@ stop() {
} }
restart() { restart() {
configtest || return $?
stop stop
start start
} }
reload() { reload() {
configtest || return $?
echo -n $"Reloading $prog: " echo -n $"Reloading $prog: "
killproc $nginx -HUP killproc $nginx -HUP
RETVAL=$? RETVAL=$?
@ -64,6 +66,10 @@ force_reload() {
restart restart
} }
configtest() {
$nginx -t -c $NGINX_CONF_FILE
}
rh_status() { rh_status() {
status $prog status $prog
} }
@ -81,7 +87,7 @@ case "$1" in
rh_status_q || exit 0 rh_status_q || exit 0
$1 $1
;; ;;
restart) restart|configtest)
$1 $1
;; ;;
reload) reload)
@ -98,6 +104,6 @@ case "$1" in
rh_status_q || exit 0 rh_status_q || exit 0
;; ;;
*) *)
echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}" echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload|configtest}"
exit 2 exit 2
esac esac