标签:$2 nohup phone zipkin tis turn 启动 hone run
#!/bin/bashapp_name=$1
pid=ps aux | grep java | grep $app_name | grep -v "grep" | awk ‘{print $2}‘
usags() {
echo "Usags: sh boot.sh [eureka|config|auth|emqtt|crm|upm|uc|upload|gateway|notification|wx|zipkin|phonestatisctis] [start|stop|status]"
exit 1
}
#检查程序是否在运行
is_exist() {
if [ -z "${pid}" ];then
return 1
else
return 0
fi
}
#启动
is_start() {
is_exist
if [ $? -eq "0" ];then
echo "${app_name} is running"
else
if [ $app_name == "eureka" ];then
cd /application/jar/$app_name
java -Xms512m -Xmx1024m -jar workos-eureka.jar >> nohup.out&
elif [ $app_name == "config" ];then
cd /application/jar/$app_name
java -Xms512m -Xmx1024m -jar workos-config.jar >> nohup.out&
elif [ $app_name == "auth" ];then
cd /application/jar/$app_name
java -Xms512m -Xmx1024m -jar workos-auth-server.jar >> nohup.out&
elif [ $app_name == "crm" ];then
cd /application/jar/$app_name
java -Xms1024m -Xmx2048m -jar workos-crm-service.jar >> nohup.out&
elif [ $app_name == "emqtt" ];then
cd /application/jar/$app_name
java -Xms512m -Xmx1024m -jar workos-emqtt.jar >> nohup.out&
elif [ $app_name == "gateway" ];then
cd /application/jar/$app_name
java -Xms1024m -Xmx2048m -jar workos-gateway.jar >> nohup.out&
elif [ $app_name == "notification" ];then
cd /application/jar/$app_name
java -Xms512m -Xmx1024m -jar workos-notification-service.jar >> nohup.out&
elif [ $app_name == "phonestatisctis" ];then
cd /application/jar/$app_name
java -Xms512m -Xmx1024m -jar workos-phonestatisctis.jar >> nohup.out&
elif [ $app_name == "uc" ];then
cd /application/jar/$app_name
java -Xms1024m -Xmx2048m -jar workos-uc.jar >> nohup.out&
elif [ $app_name == "upm" ];then
cd /application/jar/$app_name
java -Xms1024m -Xmx2048m -jar workos-upm-service.jar >> nohup.out&
elif [ $app_name == "wx" ];then
cd /application/jar/$app_name
java -Xms1024m -Xmx2048m -jar workos-wx.jar >> nohup.out&
elif [ $app_name == "upload" ];then
cd /application/jar/$app_name
java -Xms1024m -Xmx2048m -jar workos-upload.jar >> nohup.out&
else
cd /application/jar/$app_name
java -Xms256m -Xmx512m -jar workos-zipkin.jar >> nohup.out&
fi
fi
}
#停止
is_stop() {
is_exist
if [ $? -eq "0" ];then
kill -9 $pid
else
echo "${app_name} is not running"
fi
}
#状态
is_status() {
is_exist
if [ $? -eq "0" ];then
echo "${app_name} is running"
else
echo "${app_name} is no running"
fi
}
#根据输入参数,选择执行方法
case "$1" in
"zipkin")
case "$2" in
"start")
is_start
;;
"stop")
is_stop
;;
"status")
is_status
;;
)
usags
;;
esac
;;
"config")
case "$2" in
"start")
is_start
;;
"stop")
is_stop
;;
"status")
is_status
;;
)
usags
;;
esac
;;
"auth")
case "$2" in
"start")
is_start
;;
"stop")
is_stop
;;
"status")
is_status
;;
)
usags
;;
esac
;;
"gateway")
case "$2" in
"start")
is_start
;;
"stop")
is_stop
;;
"status")
is_status
;;
)
usags
;;
esac
;;
"upm")
case "$2" in
"start")
is_start
;;
"stop")
is_stop
;;
"status")
is_status
;;
)
usags
;;
esac
;;
"uc")
case "$2" in
"start")
is_start
;;
"stop")
is_stop
;;
"status")
is_status
;;
)
usags
;;
esac
;;
"crm")
case "$2" in
"start")
is_start
;;
"stop")
is_stop
;;
"status")
is_status
;;
)
usags
;;
esac
;;
"wx")
case "$2" in
"start")
is_start
;;
"stop")
is_stop
;;
"status")
is_status
;;
)
usags
;;
esac
;;
"upload")
case "$2" in
"start")
is_start
;;
"stop")
is_stop
;;
"status")
is_status
;;
)
usags
;;
esac
;;
"eureka")
case "$2" in
"start")
is_start
;;
"stop")
is_stop
;;
"status")
is_status
;;
)
usags
;;
esac
;;
"emqtt")
case "$2" in
"start")
is_start
;;
"stop")
is_stop
;;
"status")
is_status
;;
)
usags
;;
esac
;;
"notification")
case "$2" in
"start")
is_start
;;
"stop")
is_stop
;;
"status")
is_status
;;
)
usags
;;
esac
;;
"phonestatisctis")
case "$2" in
"start")
is_start
;;
"stop")
is_stop
;;
"status")
is_status
;;
)
usags
;;
esac
;;
)
usags
;;
esac
标签:$2 nohup phone zipkin tis turn 启动 hone run
原文地址:https://blog.51cto.com/13520761/2420564