码迷,mamicode.com
首页 > Web开发 > 详细

编译安装php-fpm 重启脚本

时间:2017-04-05 18:11:45      阅读:246      评论:0      收藏:0      [点我收藏+]

标签:phpfpm重启 php脚本

#!/bin/bash

pid="/opt/php7/var/run/php-fpm.pid"
ini="/opt/php7/etc/php.ini"
conf="/opt/php7/etc/php-fpm.conf"
if [ -f /opt/php7/var/run/php-fpm.pid ];then
echo "pid exists"
fi
if [ -f /opt/php7/etc/php.ini ];then
echo "ini file exists"
fi
if [ -f /opt/php7/etc/php-fpm.conf ];then
echo "php-fpm configure file exists"
fi

echo $1
case $1 in
start)
  if [ -f $pid ];then
    echo "Process already exists."
  else
    /opt/php7/sbin/php-fpm -c $ini -y $conf 
    if (( $?==0 ));then
      echo "Start php-fpm success"
    else
      echo "Start faild......"
    fi
  fi
  ;;
stop)
  if [ -f $pid ];then
    echo "Stop php-fpm process"
    kill $(cat $pid)
    if (( $?==0 ));then
      echo "Stop php-fpm over."
    else
      echo "Stop php-fpm faild..."
    fi
  else
    echo "Check process exists?"
  fi
;;
restart)
  if [ -f $pid ];then
    kill $(cat $pid)
    if (( $?==0 ));then
      echo "Stop php-fpm over"
      /opt/php7/sbin/php-fpm -c $ini -y $conf
      if (( $?==0 ));then
        echo "Start php-fpm over"
      else
        echo "Start faild"
      fi
    else
      echo "Stop faild"
    fi
  else
    /opt/php7/sbin/php-fpm -c $ini -y $conf
    if (( $?==0 ));then
      echo "Start php-fpm over"
    else
      echo "Star faild"
    fi
  fi
;;
*)
  echo "Usage: php.sh (start|stop|restart)"
esac



readme:

    保存为shell脚本文件,直接运行,会提示使用方法,根据安装环境,修改pid ini conf 等文件路径。




本文出自 “千面” 博客,请务必保留此出处http://oslibo.blog.51cto.com/10854638/1913101

编译安装php-fpm 重启脚本

标签:phpfpm重启 php脚本

原文地址:http://oslibo.blog.51cto.com/10854638/1913101

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!