前面完成了第一版的部署脚本,这次提供启动和关闭lnpp的脚本,统一进行控制进行补充,之所以不合并,是因为启动和关闭有关联,还有每个人有不同的启动参数控制呢,所以之做补充 ...
先看 PHP 5.3.10 + Nginx 1.0.12 + PostgreSQL 9.1.2 源码编译自动化部署第一版
接下来是启动和关闭脚本
#!/bin/bash PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin export PATH # Source function library. . /etc/rc.d/init.d/functions # Source networking configuration. . /etc/sysconfig/network # Check that networking is up. [ "$NETWORKING" = "no" ] && exit 0 #start shell script LNPP_ROOT=/tmp/lnpp PHP=$LNPP_ROOT/php/sbin/php-fpm NGINX=$LNPP_ROOT/nginx/sbin/nginx PG_ROOT=$LNPP_ROOT/pgsql PGDAEMON=$PG_ROOT/bin/postmaster PGCTL=$PG_ROOT/bin/pg_ctl PGUSER=postgres PGDATA=$PG_ROOT/data PGLOG=$PG_ROOT/logs/pgsql.log start() { echo "-------------start php---------------" $LNPP_ROOT/php/sbin/php-fpm echo "-------------start success---------------" echo "-------------start nginx-------------" $LNPP_ROOT/nginx/sbin/nginx echo "-------------start success---------------" echo "-------------start pgsql---------------" su $PGUSER -c "$PGDAEMON -D '$PGDATA' &" >>$PGLOG 2>&1 echo "-------------start success---------------" } stop() { echo "-------------stop php----------------" ps -e | grep $(basename $PHP) | { while read pid tty time cmd; do echo "killing $pid ==> $cmd" kill -9 $pid done } echo "-------------stop nginx--------------" killproc $NGINX -QUIT echo "-------------stop pgsql--------------" su $PGUSER -c "$PGCTL stop -D '$PGDATA' -m fast" echo "-------------stop pgsql--------------" } case "$1" in start) start ;; stop) stop ;; *) echo {1}quot;Usage: $0 {start|stop}" RETVAL=1 esac exit $RETVAL1.保存内容成lnpp.sh
2.LNPP_ROOT=/tmp/lnpp 修改成lnpp安装地址。
3.复制为/etc/rc.d/init.d/lnpp
4.#chmod a+x /etc/rc.d/init.d/lnpp
5.server lnpp start
Addition:
lnpp.sh 在这里