Search code examples
file-uploadncftp

NcFTP -S with -bb


I am trying to upload all changed files to my FTP server. However, I cannot use -S .tmp and -v when I use the -bb flag - and I can't use those options with ncftpbatch at all. Here is my code:

#!/bin/bash -eo pipefail
IN=$(git diff-tree --no-commit-id --name-only -r HEAD)
OUT=$(echo $IN | tr ";" "\n")
for file in "${OUT[@]}"; do
    ncftpput -bb -S .tmp -v -u "[email protected]" -p "*****" ftp.kolechia.heliohost.org "/" $file
done
ncftpbatch

As you can see, I need the -S .tmp to avoid breaking the site during uploads. -v provides output to prevent my CI service from timing out.

How can I upload only the changed files - without temporarily breaking the site? I'm thinking of just logging in separately for each file, but that is bad practice.


Solution

  • Why not launch a function in background which just prints dummy values like uploading, please wait and then sleeps for few seconds and do it again. Outside the loop you can kill that background job

    If you don't want any output

    printf "\0" 
    

    or

    printf "a\b"