More bugs
This commit is contained in:
@@ -35,15 +35,18 @@ mosquitto_sub -h 127.0.0.1 -p 1883 -t "$TOPIC" | while IFS="=" read -r key value
|
||||
loc_sz=$(stat -c %s "$sp" 2>/dev/null || echo 0)
|
||||
|
||||
# Fetch remote size
|
||||
log "DEBUG" "rclone lsjson "$remote_f""
|
||||
rem_sz=$(rclone lsjson "$remote_f" 2>/dev/null | grep -o '"Size":[0-9]*' | cut -d: -f2)
|
||||
: "${rem_sz:=0}"
|
||||
|
||||
if [ "$loc_sz" -lt "$rem_sz" ]; then
|
||||
log "WARN" "Cloud save larger. Restoring..."
|
||||
mkdir -p "$(dirname "$bp")"
|
||||
log "DEBUG" "rclone copyto "$remote_f" "$sp" --backup-dir "$(dirname "$bp")""
|
||||
rclone copyto "$remote_f" "$sp" --backup-dir "$(dirname "$bp")"
|
||||
else
|
||||
log "INFO" "Local save current. Updating..."
|
||||
log "DEBUG" "rclone update "$remote_f" "$sp""
|
||||
rclone update "$remote_f" "$sp"
|
||||
fi
|
||||
|
||||
@@ -55,6 +58,7 @@ mosquitto_sub -h 127.0.0.1 -p 1883 -t "$TOPIC" | while IFS="=" read -r key value
|
||||
# Syncing on end - we don't necessarily need to block here
|
||||
(
|
||||
log "INFO" "Syncing END for $(basename "$sp")"
|
||||
log "DEBUG" "rclone update "$sp" "$REMOTE_BASE/$sid/""
|
||||
rclone update "$sp" "$REMOTE_BASE/$sid/"
|
||||
log "INFO" "Final Sync Done."
|
||||
|
||||
|
||||
Reference in New Issue
Block a user