概述
#!/bin/bash
#开启nginx
deploy_nginx(){
#查找nginx的进程
PIDS=`ps -ef|grep nginx | grep -v grep | awk '{print $2}'`
echo "进程为:$PIDS"
#如果PIS长度为0,即没有开启
if [ -z "$PIDS" ]; then
echo "nginx is not started"
else
echo -e "stopping the nginx"
for PID in $PIDS ; do
kill $PID > /dev/null 2>&1
done
sleep 1
fi
cd /usr/local/nginx/sbin/
./nginx
}
#开启zookeeper
deploy_zookeeper(){
#查找nginx的进程
PIDS=`ps -ef|grep zookeeper | grep -v grep | awk '{print $2}'`
echo "进程为:$PIDS"
#如果PIS长度为0,即没有开启
if [ -z "$PIDS" ]; then
echo "zookeeper is not started"
else
echo -e "stopping the zookeeper"
for PID in $PIDS ; do
kill $PID > /dev/null 2>&1
done
sleep 1
fi
sh /usr/local/apache-zookeeper-3.7.0-bin/bin/zkServer.sh start
}
#test
deploy_test(){
echo $1
}
#这个得写在下面
case $1 in
nginx)
deploy_nginx
;;
zookeeper)
deploy_zookeeper
;;
demo)
deploy_test $1
;;
*)
deploy_nginx
deploy_zookeeper
;;
esac
最后
以上就是威武皮皮虾为你收集整理的nginx、zookeeper启动脚本的全部内容,希望文章能够帮你解决nginx、zookeeper启动脚本所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
发表评论 取消回复