@@ -34,6 +34,7 @@ chmod u=rwx,g=rx,a=rx /usr/bin/tpi-task
3434
3535sudo tee /usr/bin/tpi-task-shutdown << 'END'
3636#!/bin/bash
37+ sleep 20; while pgrep rclone > /dev/null; do sleep 1; done
3738if ! test -z "$CI"; then
3839 cml rerun-workflow
3940fi
@@ -66,6 +67,7 @@ sudo tee /etc/systemd/system/tpi-task.service > /dev/null <<END
6667 EnvironmentFile=/tmp/tpi-environment
6768 WorkingDirectory=/tmp/tpi-task
6869 TimeoutStartSec=%s
70+ TimeoutStopSec=infinity
6971[Install]
7072 WantedBy=default.target
7173END
@@ -106,16 +108,18 @@ sudo systemctl enable tpi-task.service --now
106108while sleep 5; do
107109 journalctl > "$TPI_LOG_DIRECTORY/machine-$TPI_MACHINE_IDENTITY"
108110 journalctl --unit tpi-task > "$TPI_LOG_DIRECTORY/task-$TPI_MACHINE_IDENTITY"
109- if [[ "$(stat -t "$TPI_LOG_DIRECTORY")" != "$TPI_LOG_DIRECTORY_HASH" ]]; then
110- TPI_LOG_DIRECTORY_HASH="$(md5sum "$TPI_LOG_DIRECTORY"/*)"
111- rclone copy "$TPI_LOG_DIRECTORY" "$RCLONE_REMOTE/reports"
111+ NEW_TPI_LOG_DIRECTORY_HASH="$(md5sum "$TPI_LOG_DIRECTORY"/*)"
112+ if [[ "$NEW_TPI_LOG_DIRECTORY_HASH" != "$TPI_LOG_DIRECTORY_HASH" ]]; then
113+ TPI_LOG_DIRECTORY_HASH="$NEW_TPI_LOG_DIRECTORY_HASH"
114+ rclone sync "$TPI_LOG_DIRECTORY" "$RCLONE_REMOTE/reports"
112115 fi
113116done &
114117
115118while sleep 10; do
116- if [[ "$(stat -t "$TPI_DATA_DIRECTORY")" != "$TPI_DATA_DIRECTORY_EPOCH" ]]; then
117- TPI_DATA_DIRECTORY_EPOCH="$(find "$TPI_DATA_DIRECTORY" -printf "%%T@\n" | sort | tail -1)"
118- rclone copy "$TPI_DATA_DIRECTORY" "$RCLONE_REMOTE/data"
119+ NEW_TPI_DATA_DIRECTORY_EPOCH="$(find "$TPI_DATA_DIRECTORY" -printf "%%T@\n" | sort | tail -1)"
120+ if [[ "$NEW_TPI_DATA_DIRECTORY_EPOCH" != "$TPI_DATA_DIRECTORY_EPOCH" ]]; then
121+ TPI_DATA_DIRECTORY_EPOCH="$NEW_TPI_DATA_DIRECTORY_EPOCH"
122+ rclone sync "$TPI_DATA_DIRECTORY" "$RCLONE_REMOTE/data"
119123 fi
120124done &
121125` ,
0 commit comments