diff --git a/task/common/machine/script.go b/task/common/machine/script.go index f13cf824..510eacea 100644 --- a/task/common/machine/script.go +++ b/task/common/machine/script.go @@ -61,7 +61,7 @@ sudo tee /etc/systemd/system/tpi-task.service > /dev/null < "$TPI_LOG_DIRECTORY/status-$TPI_MACHINE_IDENTITY" && rclone copy "$TPI_LOG_DIRECTORY" "\$RCLONE_REMOTE/reports"' + ExecStop=/bin/bash -c 'systemctl is-system-running | grep stopping || echo "{\\\\"result\\\\": \\\\"\$SERVICE_RESULT\\\\", \\\\"code\\\\": \\\\"\$EXIT_STATUS\\\\", \\\\"status\\\\": \\\\"\$EXIT_CODE\\\\"}" > "$TPI_LOG_DIRECTORY/status-$TPI_MACHINE_IDENTITY" && RCLONE_CONFIG= rclone copy "$TPI_LOG_DIRECTORY" "\$RCLONE_REMOTE/reports"' ExecStopPost=/usr/bin/tpi-task-shutdown Environment=HOME=/root EnvironmentFile=/tmp/tpi-environment