diff --git a/scripts/scheduler/check_pid.sh b/scripts/scheduler/check_pid.sh new file mode 100644 index 0000000..118db49 --- /dev/null +++ b/scripts/scheduler/check_pid.sh @@ -0,0 +1,21 @@ +#!/bin/sh + +PID="$1" +TASK="$2" +DATE="$3"; +REDIS_SERVER="$4" +REDIS_PORT="$5" + +if [ "$PID" != "" ]; then + + debug "JSON_TARGET: $JSON_TARGET" + + wait $PID + + JSON_TARGET=$(echo '{ "DATE": "'$DATE'", "STATUS": "2" }' | jq -r . | base64 -w0) + debug "JSON_TARGET: $JSON_TARGET" + + redis-cli -h $REDIS_SERVER -p $REDIS_PORT SET $TASK "$JSON_TARGET" + +fi; + diff --git a/scripts/scheduler/entrypoint.sh b/scripts/scheduler/entrypoint.sh index d0f8fd0..21d934b 100644 --- a/scripts/scheduler/entrypoint.sh +++ b/scripts/scheduler/entrypoint.sh @@ -157,7 +157,8 @@ deploy_additionals() { # start service debug "$service_exec service-$NAME.json start info" - $service_exec service-$NAME.json start info + $service_exec service-$NAME.json start info & + PID=$! } remove_additionals() { @@ -760,7 +761,7 @@ execute_task() { DEPLOY_PAYLOAD=$(echo "$JSON" | jq -r .PAYLOAD) # base64 list of key-value pairs in JSON deploy_additionals "$APP_DIR" "$DEPLOY_NAME" "$DEPLOY_PAYLOAD" - JSON_TARGET=$(echo '{ "DATE": "'$DATE'", "STATUS": "2" }' | jq -r . | base64 -w0) + sh /scripts/check_pid.sh "$PID" "$TASK" "$DATE" "$REDIS_SERVER" "$REDIS_PORT" & fi fi done