【发布时间】:2019-03-13 14:25:15
【问题描述】:
我有一个 curl 命令启动或停止进程。当我运行它以启动/停止服务时,脚本按预期工作,但是当进程已经启动并且我尝试启动它时它会抛出异常再次。如何优雅地退出?
脚本:
x=$1
action=`echo "$x" | tr '[:upper:]' '[:lower:]'`
y=$2
#echo "ID passed is $y"
echo $action"ing the process..."
curl -s -S -k -u user:pass -X PUT https://URL/$action || exit 1
如果进程停止/启动,它会起作用。当我尝试启动已经处于“已启动”状态的进程时会出现问题。
用法:./abc.sh start/stop 12345
错误信息是:
HTTP 409: Conflict
org.apache.juneau.rest.RestException: Action START cannot be performed for application instance TechDev2 (fadc6b5c-782a-46a1-bf46-21f331f669c0) because its state is STARTED.
at com.platform.vem.gui.web.rest.EgoRestCallHandler.renderError(EgoRestCallHandler.java:60)
at com.ibm.asc.ascd.core.rest.api.ConductorRestCallHandler.renderError(ConductorRestCallHandler.java:79)
at org.apache.juneau.rest.RestCallHandler.handleError(RestCallHandler.java:273)
at org.apache.juneau.rest.RestCallHandler.service(RestCallHandler.java:189)
【问题讨论】: