I have a script for backing up my data. The last line is:
echo "$FTPConnectstring
$FTPCommands
bye" | ftp -ivn
It works great, but I wish I could 'trickle' this (i.e. limit upload bandwidth usage). I tried many command lines like these:
echo "$FTPConnectstring
$FTPCommands
bye" | ftp -ivn | trickle -s -u 4096
but ftp transfer seems to execute with no BW usage limit I also tried something like this
FinalCommand=$(echo -e "$FTPConnectstring\n$FTPCommands\nbye")
trickle -s -u 4096 ftp -ivn ${FinalCommand}
but this one doesn't connect ftp correctly...
Any help appreciated !!
In your first attempt, you only
trickle
the standard output fromftp
(depending on the implementation, probably just the progress messages, if even that). In your second attempt, you have a syntax error; the argument toftp
should be a host name, not a command sequence. Try this instead:If the
ftp
binary is statically linked,trickle
can't override its socket-handling internals; but in that case, you can probably switch to a different FTP client such asncftp
which should also behave better with scripting.