#!/bin/sh NGINX_BIN="/usr/local/ciaos/sbin/nginx" # Shell functions sourced from /etc/rc.status: # rc_check check and set local and overall rc status # rc_status check and set local and overall rc status # rc_status -v ditto but be verbose in local rc status # rc_status -v -r ditto and clear the local rc status # rc_failed set local and overall rc status to failed # rc_failed <num> set local and overall rc status to <num><num> # rc_reset clear local rc status (overall remains) # rc_exit exit appropriate to overall rc status . /etc/rc.status rc_reset ulimit -SHn 65535 PHPFPM='/usr/local/ciaos/etc/init.d/php-fpm' case "$1" in start) echo -n "Starting Nginx" startproc $NGINX_BIN rc_status -v $PHPFPM start ;; stop) echo -n "Shutting down Nginx" killproc -TERM $NGINX_BIN rc_status -v $PHPFPM stop ;; restart) $0 stop $0 start rc_status ;; reload) echo -n "Reloading Nginx" killproc -HUP $NGINX_BIN rc_status -v $PHPFPM reload ;; status) echo -n "Checking for Nginx: " checkproc $NGINX_BIN rc_status -v ;; *) echo "Usage: $0 {start|stop|status|restart|reload|probe}" exit 1 ;; esac rc_exit
保存问test.sh,可以简单地时间服务开启关闭查看状态等操作(效果如下)
ciaos #./test.sh start Starting Nginx done Starting php-fpm done, pid file found. ciaos #./test.sh status Checking for Nginx: running ciaos #./test.sh restart Shutting down Nginx done Gracefully shutting down php-fpm . done Starting Nginx done Starting php-fpm done ciaos #./test.sh stop Shutting down Nginx done Gracefully shutting down php-fpm . done
附参考链接:Opensuse启动脚本