sync-library.sh: run the closing report under sh, not the remote login shell
The report was an ssh command string, which the remote user's login shell runs - and on the devices root's is fish, which rejects `if ...; then`. The copy itself finished, but the script then exited 127 at the very end, so a successful sync looked failed. Feed the report to `sh -s` on stdin instead. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -224,14 +224,17 @@ if [[ $DRY_RUN -eq 1 ]]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
ssh "$SSH_TARGET" "
|
||||
echo 'library: '\$(du -sh '$DEST' 2>/dev/null | cut -f1)
|
||||
echo 'free: '\$(df -Ph '$DEST' | awk 'NR==2 {print \$4}')
|
||||
if [ -d '${DEST}/.musicmouse-cache' ]; then
|
||||
echo 'covers: '\$(find '${DEST}/.musicmouse-cache/covers' -type f 2>/dev/null | wc -l)' files'
|
||||
echo 'analysis: '\$(find '${DEST}/.musicmouse-cache/analysis' -type f 2>/dev/null | wc -l)' files'
|
||||
fi
|
||||
"
|
||||
# Through `sh -s` rather than as an ssh command string: that string is run by the
|
||||
# remote user's login shell, and on the devices root's is fish, which rejects
|
||||
# `if ...; then`. The heredoc expands $DEST here; the escaped \$ ones run remotely.
|
||||
ssh "$SSH_TARGET" sh -s <<EOF
|
||||
echo "library: \$(du -sh '$DEST' 2>/dev/null | cut -f1)"
|
||||
echo "free: \$(df -Ph '$DEST' | awk 'NR==2 {print \$4}')"
|
||||
if [ -d '${DEST}/.musicmouse-cache' ]; then
|
||||
echo "covers: \$(find '${DEST}/.musicmouse-cache/covers' -type f 2>/dev/null | wc -l) files"
|
||||
echo "analysis: \$(find '${DEST}/.musicmouse-cache/analysis' -type f 2>/dev/null | wc -l) files"
|
||||
fi
|
||||
EOF
|
||||
|
||||
cat <<EOF
|
||||
|
||||
|
||||
Reference in New Issue
Block a user