签批服务监听异常停止自动重启

如果签批服务因各种原因服务异常自动停止了,需要自动立即重启,可创建一个监听脚本。实现自动重启。 1. 进入/opt目录下创建文件monitor_wellsign_tomcat.sh。可执行`touch /opt/monitor_wellsign_tomcat.sh` 2. 编辑 monitor_wellsign_tomcat.sh 文件,写入以下内容: ```language #!/bin/bash ps -ef |grep "/opt/wellsign-sdko-off/tomcat/" | grep -v grep if [ $? -eq 0 ]; then echo "founded /opt/wellsign-sdko-off/tomcat" >/dev/null else cd /opt/wellsign-sdko-off /opt/wellsign-sdko-off/tomcat/bin/startup.sh 2>&1 & logger " /opt/wellsign-sdko-off/tomcat/bin/startup.sh" fi ``` 3. 赋予执行权限,执行`chmod 744 /opt/touch monitor_wellsign_tomcat.sh` 4. 执行 `corntab -e`,填入 `*/1 * * * * /opt/monitor_wellsign_tomcat.sh`。 5. 这样就会每分钟监测 1 次。如果服务挂了,会自动重启。