diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index 2fa59dd730b21861911bc0f0cb45075e2b31c2c0..798e27af3fa171c4763862fe1560537c61d2a2f5 100755 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -11,21 +11,30 @@ sleep 5 if [ -z "$OTP_TOKEN" ]; then echo "syncing library" + date seaf-cli sync -l "$LIBRARY" -s "$SERVER" -d "/sync" -u "$EMAIL" -p "$PASSWORD" else echo "syncing library with OTP" + date seaf-cli sync -l "$LIBRARY" -s "$SERVER" -d "/sync" -u "$EMAIL" -p "$PASSWORD" --tfa $(oathtool --totp -b "$OTP_TOKEN") fi maxretry=4 retry=0 +lastoutput="" +output="" + while [ "$retry" -le "$maxretry" ]; do ps aux | grep seafile | grep -v grep > /dev/null 2> /dev/null || { retry=$(expr $retry + 1); } - date - seaf-cli status + output=$(seaf-cli status) + if [[ "$output" != "$lastoutput" ]]; then + date + echo "$output" + lastoutput="$output" + fi sleep 5 done echo "Seafile not running"