nginx起動スクリプト
需要があるかどうかわからないけど、nginxの起動停止スクリプトをのせておく。
nginx_binは環境に合わせて変更すること。
#!/bin/sh # chkconfig: 345 99 20 # description: nginx Web Server # processname: nginx export nginx_bin=/usr/local/nginx/sbin/nginx if [ $# -ne 1 ]; then echo "Usage: $0 [start|restart|stop|status]" fi case $1 in start ) $nginx_bin ;; stop ) $nginx_bin -s stop ;; restart ) $nginx_bin -s stop $nginx_bin ;; configtest ) $nginx_bin -t ;; esac exit 0
reloadの挙動がよくわからなかったので、restartは一旦止めて改めて起動するようにしている。
chkconfigで自動起動させる場合は、スクリプトを/etc/init.d/nginxに置いてから次のようにする(root権限必須)
# chkconfig httpd off # chkconfig --add nginx # chkconfig nginx on # chkconfig --list nginx nginx 0:off 1:off 2:on 3:on 4:on 5:on 6:off # service nginx start