echo"========================================" echo"java bin path: $JAVA_EXE" echo"slave client home path: $SLAVE_HOME" echo"slave client bin path: $BIN_PATH" echo"load slave client conf: $SLAVE_CONFIG" echo"========================================" echo"jenkins connection params:" echo" - server host: $SERVER_HOST" echo" - server port: $SERVER_PORT" echo" - slave name: $SLAVE_NAME" echo" - secret id: $SECRET_ID" echo"========================================"
functionstartup() { echo"execute get process command: $SLAVE_PID_COMMAND" if [ -n "$SLAVE_PID" ]; then echo"process with $SECRET_ID has existed." echo"jenkins slave client pid: $SLAVE_PID" exit 0; fi
echo"execute script shell: $START_COMMAND" eval$START_COMMAND if [ $? -ne 0 ]; then echo"fail to startup the jenkins slave client." exit 1; fi
SLAVE_PID=$(eval$SLAVE_PID_COMMAND) echo"the jenkins slave client process id: $SLAVE_PID" return; }
functionshutdown() { echo"execute get process command: $SLAVE_PID_COMMAND" if [ -z "$SLAVE_PID" ]; then echo"no process with $SECRET_ID" exit 0; fi echo"killing process with pid: $SLAVE_PID" kill -9 $SLAVE_PID
if [ $? -ne 0 ]; then echo"fail to shutdown the jenkins slave client with pid: $SLAVE_PID" exit 1; fi
echo"the jenkins slave client has stoped." return; }