Hello,
Recently I have changed some crontab scripts which I execute to do different tasks mainly transfering some files from one server to the other.
The main change was the protocol from ftp transfer to sftp. Ftp server was the MS Windows default service, and Sftp server is an proprietary sw (attachmate).
My question has to do with the output (log file) of the script which doesn't show transfer info (size and bandwidth)
Below the differences between the ftp scripts log and sftp
FTP log output:
Connected to SERVER.
220 Microsoft FTP Service
331 Password required
230 User logged in.
200 Type set to I.
250 CWD command successful.
Local directory now /dir
200 PORT command successful.
125 Data connection already open; Transfer starting.
226 Transfer complete.
1836 bytes sent in 0.001078 seconds (1663 Kbytes/s)
local: file1.txt remote: file1.txt
250 CWD command successful.
200 PORT command successful.
125 Data connection already open; Transfer starting.
226 Transfer complete.
1836 bytes sent in 0.000823 seconds (2179 Kbytes/s)
local: file1.txt remote: file1.txt
221 Goodbye.
SFTP log output:
Connected to SERVER.
sftp> cd DIR
sftp> lcd /dir
sftp> put file2.txt
Uploading file2.txt to /Home/DIR/file2.txt
sftp> bye
Is it possible to have the size of sftp transfer and bandiwdth like for ftp?
Hi RudiC,
I tested with the passing of -v parameter to sftp but I do get a lot of debug information for ssh which is not really useful for me.
On the last lines I get some information about the transfer rate and file size but it it somehow different from the easy readable output of ftp
sftp -v :
....
a lot of debug info
.....
Transferred: sent 2960, received 2712 bytes, in 0.6 seconds
Bytes per second: sent 5001.1, received 4582.1
ftp:
1836 bytes sent in 0.001078 seconds (1663 Kbytes/s)
I also tested by enabling the progress meter of sftp but again on the final output log I do not get any transfer/size information.
Strange because when I execute manually the sftp commands from shell I do get the output info:
root/server:/>sftp user@$SERVER
Connected to SERVER
sftp> put dates.txt
Uploading dates.txt to /Home/dates.txt
dates.txt 100% 55 0.1KB/s 00:00
sftp>
Meanwhile with the below script which I use I do not have this info on the logfile:
The progress meter uses terminal control codes and thus is not (utmost) suitable for text/log files. So sftp suppresses it when it detects it is not logging to the screen. How about