秀场自动化部署shell脚本规划

#!/bin/bash

echo “现在开始安装国际版秀场……


#因为不同的机器所需的配置不同,所以要先确定机

ps aux |grep -v grep |grep datacenter >/dev/null 2>&1

if [ $? = “0” ];then

echo “这台机器是Datacenter,继续执行下列步骤:


echo “setp 1 : 修改php-fpm的配置:


ps aux |grep -v grep|grep php-fpm >/dev/null 2>&1

if [ $? = “0” ] || [ -f /etc/php5/fpm/pool.d/www.conf ];then

#echo “php-fpm已安装,修改php-fpm的配置”

cp /etc/php5/fpm/pool.d/www.conf /etc/php5/fpm/pool.d/www.conf.`date +%Y%m%d`

sed -ri ‘/pm.max_children/s/[0-9]+/500/’ /etc/php5/fpm/pool.d/www.conf | grep pm.max_children

#重启php-fpm生效

/etc/init.d/php5-fpm restart

echo “成功修改php-fpm配置文件”

else

#php-fpm没安装成功,或者/etc/php5/fpm/pool.d/www.conf文件不存在

echo “php-fpm没安装,或配置异常,请先安装或检查!”

#以后可以补充安装的过程

exit

fi

echo “setp 2 : 配置datacente(conf/config.xml)

ps aux |grep -v |grep datacenter >/dev/null 2>&1

if [ $? = “0” ] || [ -f /data/applications/datacenter/conf/config.xml ];then

cp /data/applications/datacenter/conf/config.xml /data/applications/datacenter/conf/config.xml.`date +%Y%m%d`

#修改配置的datacenter需要知道svid才能修改。到时获取到分配规则再补充

else

echo “datacenter没安装,或配置异常,请先安装或检查!”

fi
echo “step 3 : 检查所有配置是否正确

ps aux |grep -v grep |grep php-fpm >/dev/null 2>&1

if [ $? = “0” ];then

echo “php配置修改后并重启成功”

else

echo “php启动失败,请检查配置”

fi

netstat -ntlp |grep 9000

if [ $? = “0” ];then

echo “端口9000已经监听”

else

echo “9000端口不在监听状态,请检查配置”

fi

ps aux |grep -v grep |grep redis

if [ $? = “0” ] || [ -d /etc/redis ];then

echo “redis已安装,并成功启动”

mem = `awk ‘/maxmemory/ && !/^#/ {print $2/1000000″G”}’ /etc/redis/redis.conf`

echo “maxmemory 为 $mem”

cat /etc/redis/redis.conf |grep -v ‘^#’|grep save

if [ $? = “0” ];then

echo “redis自身持久化还没关闭。”

else

echo “redis自身持久化已经关闭。”

fi

else

echo “redis没安装或没成功启动,请先安装redis”

exit

fi

 

else

echo “这台机器是voice,将执行下列步骤:

echo “setp 1 :配置秀场插件giftsystem(conf/config.xml)”
echo “setp 2 : 配置视频插件rcast ”

 

 

 

fi

发表评论

电子邮件地址不会被公开。 必填项已用*标注

您可以使用这些HTML标签和属性: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>