nginx启动脚本
#!/bin/sh
#
# nginx - this script starts and stops the nginx daemin
#
# chkconfig: - 85 15
# description: Nginx is an HTTP(S) server, HTTP(S) reverse \
# proxy and IMAP/POP3 proxy server
# processname: nginx
# config: /etc/nginx/nginx.conf
# pidfile: /usr/local/nginx/logs/nginx.pid
# Source function library.
. /etc/rc.d/init.d/functions
# Source networking configuration.
. /etc/sysconfig/network
# Check that networking is up.
[ "$NETWORKING" = "no" ] && exit 0
nginx="/usr/local/nginx/sbin/nginx"
prog=$(basename $nginx)
NGINX_CONF_FILE="/etc/nginx/nginx.conf"
lockfile=/var/lock/subsys/nginx
start() {
[ -x $nginx ] || exit 5
[ -f $NGINX_CONF_FILE ] || exit 6
echo -n $"Starting $prog: "
daemon $nginx -c $NGINX_CONF_FILE
retval=$?
echo
[ $retval -eq 0 ] && touch $lockfile
return $retval
}
stop() {
echo -n $"Stopping $prog: "
killproc $prog -QUIT
retval=$?
echo
[ $retval -eq 0 ] && rm -f $lockfile
sleep 1
return $retval
}
restart() {
configtest || return $?
stop
start
}
reload() {
configtest || return $?
echo -n $"Reloading $prog: "
killproc $nginx -HUP
RETVAL=$?
echo
}
force_reload() {
restart
}
configtest() {
$nginx -t -c $NGINX_CONF_FILE
}
rh_status() {
status $prog
}
rh_status_q() {
rh_status >/dev/null 2>&1
}
case "$1" in
start)
rh_status_q && exit 0
$1
;;
stop)
rh_status_q || exit 0
$1
;;
restart|configtest)
$1
;;
reload)
rh_status_q || exit 7
$1
;;
force-reload)
force_reload
;;
status)
rh_status
;;
condrestart|try-restart)
rh_status_q || exit 0
;;
*)
echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-
reload|configtest}"
exit 2
esac
# chmod 755 /etc/init.d/nginx
# chkconfig --add nginx
# service nginx start
# chkconfig nginx on
最新文章
- zend studio 13.5破解以及集成xdebug
- DELETE与TRUNCATE的区别
- HTTP 协议的历史演变和设计思路
- [C++]C++标准里 string和wstring
- 不相交集(The Disjoint Set ADT)
- 成为JavaGC专家(2)—如何监控Java垃圾回收机制
- 还是把一个课程设计作为第一篇文章吧——学生学籍管理系统(C语言)
- 转发——推荐一些国外高质量Java开发者的博客
- Vim键盘布局
- 经典dp 最长公共子序列
- hdu4463 Outlets 最小生成树
- MySQL单表查询
- python 接口自动化测试(五)其他-认证&;代理&;超时配置
- 手把手教你如何用eclipse搭建前端开发环境
- 将 Azure VM 迁移到 Azure 中的托管磁盘
- Unable to execute dex: Multiple dex files defineLcom/google/gson/JsonDeserializer;
- luogu1072 [NOIp2009]Hankson的趣味题 (数学+STL::set)
- 字体选择框QFontComboBox
- webgl之观察三维空间
- Extending Conductor
热门文章
- Dictionary和Hashtable的一些异同
- Unix调试工具dbx使用方法
- nodejs require
- machine learning 笔记 normal equation
- ajax回调打开新窗体防止浏览器拦截有效方法
- .Net“/”应用程序中的服务器错误 超过了最大请求长度 错误解决办法
- cdnbest节点安装后连不上主控常见问题
- linux学习笔记——基础命令
- SpringMVC的controller方法上若需要参数 如User
- Failed opening .rdb for saving: Permission denied