标签:prefix yum ati 自启动 gcc-c++ not conf desc and
安装nginx对应的软件 PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DESC="nginx daemon"
NAME=nginx
DAEMON=*/application/nginx*/sbin/$NAME
CONFIGFILE=*/application/nginx/*conf/$NAME.conf
PIDFILE=*/application/nginx*/logs/$NAME.pid
SCRIPTNAME=/etc/init.d/$NAME
set -e
[ -x "$DAEMON" ] || exit 0
do_start() {
$DAEMON -c $CONFIGFILE || echo -n "nginx already running"
}
do_stop() {
kill -INT `cat $PIDFILE` || echo -n "nginx not running"
}
do_reload() {
kill -HUP `cat $PIDFILE` || echo -n "nginx can‘t reload"
}
case "$1" in
start)
echo -n "Starting $DESC: $NAME"
do_start
echo "."
;;
stop)
echo -n "Stopping $DESC: $NAME"
do_stop
echo "."
;;
reload|graceful)
echo -n "Reloading $DESC configuration..."
do_reload
echo "."
;;
restart)
echo -n "Restarting $DESC: $NAME"
do_stop
do_start
echo "."
;;
*)
echo "Usage: $SCRIPTNAME {start|stop|reload|restart}" >&2
exit 3
;;
esac
exit 0
改变其权限:
chmod +x /etc/init.d/nginx
service nginx stop
chkconfig --add nginx
chkconfig nginx on
service nginx start
重启之后查看是否加入开机自启动``
ps -ef |grep nginx
标签:prefix yum ati 自启动 gcc-c++ not conf desc and
原文地址:http://blog.51cto.com/13754781/2296191