linux中启动与终止lnmp的脚本

说是lnmp, 其实暂时只是 lnp, 因为还没有安装 mysql

这是脚本:

#!/bin/bash
function lnmpstart()
{
        nginx
        /usr/local/php/bin/php-cgi -b 127.0.0.1:9000 -c /usr/local/php/lib/php.ini &
}

function lnmpstop()
{
        kill -9 `ps aux | grep php-cgi | grep -v grep | awk '{print $2}'`
        kill -9 `ps aux | grep nginx | grep -v grep | awk '{print $2}'`
}

if [ $# -eq 1 ]; then
    if [ $1 = 'start' ]; then
        lnmpstart
    elif [ $1 = 'stop' ];    then
        lnmpstop
    fi
else
    echo 'Usage: lnmp.sh [OPTION]'
    echo "    lnmp.sh start    Start daemons"
    echo "    lnmp.sh stop    Stop daemons"
    echo ""
fi

 

posted @ 2015-12-31 17:00  张不正  阅读(433)  评论(0编辑  收藏  举报
返回顶部