Trickle FTP connection

85 views Asked by At

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 !!

1

There are 1 answers

0
tripleee On BEST ANSWER

In your first attempt, you only trickle the standard output from ftp (depending on the implementation, probably just the progress messages, if even that). In your second attempt, you have a syntax error; the argument to ftp should be a host name, not a command sequence. Try this instead:

echo -e "$FTPConnectstring\n$FTPCommands\nbye" |
trickle -s -u 4096 ftp -ivn

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 as ncftp which should also behave better with scripting.