python shell脚本编程100例_《shell脚本编程100例》[1.05MB]PDF完整版下载-码农之家

用spring boot框架做的项目,将第三方包全部打在jar里面,通过shell脚本启动和停止服务,常用的shell脚本模板如下: #!/bin/bashJAVA_OPTIONS_INITIAL=-Xms128MJAVA_OPTIONS_MAX=-Xmx512M_JAR_KEYWORDS=monitor-alarm-task-1.0-SNAPSHOT.jarAPP_NAME=monitor-alarm-taskAPPLICATION_FILE=/opt/scpip_monitor/application.propertiesPID=$(ps aux | grep ${_JAR_KEYWORDS} | grep -v grep | awk '{print $2}' )ALARM_CONFIG_FILE=`pwd`/alarmConfig.yamlfunction check_if_process_is_running { if [ "$PID" = "" ]; then return 1 fi ps -p $PID | grep "java" return $?}case "$1" in status) if check_if_process_is_running then echo -e "\033[32m $APP_NAME is running \033[0m" else echo -e "\033[32m $APP_NAME not running \033[0m" fi ;; stop) if ! check_if_process_is_running then echo -e "\033[32m ……

你可能感兴趣的:(python,shell脚本编程100例)