#!/bin/sh #chkconfig: 2345 10 90 #name: nginx #description: Nginx Service Script # case $1 in start) echo "Starting Nginx..." /usr/local/nginx/nginx -c /usr/local/nginx/nginx.conf ;; stop) echo "Stopping Nginx..." /usr/bin/killall -s QUIT nginx ;; restart) echo "Reloading Nginx..." $0 stop $0 start ;; *) echo "Usage: $0 {start|stop|restart}" esac exit 0 配置自启动 chkconfig --level 2345 nginx on 脚本运行后效果如下 root@lxhtest html$service nginx stop Stopping Nginx... root@lxhtest html$service nginx start Starting Nginx... root@lxhtest html$service nginx restart Reloading Nginx... Stopping Nginx... Starting Nginx... (责任编辑:IT) |