Reputation: 5475
In My Shell Script I am trying to push the scp output to a log file.Below is the code snippet.On Command line I can see the logs but The scp logs are not pushed into the file .What can be the reason ?
FTP_LOG = "Log.txt"
scp -v ${feedFile} ${USER}@${DESTINATION}:inbox >> ${FTP_LOG}
Please help me on this as I can see that there are other people who faced the same issue when I google.
The other issue is that the last returned code after scp command doesnt really say if the file transfer was a success.Even when the file transfer fails I get the last return code as indicatng success.
Upvotes: 1
Views: 2871
Reputation: 185560
The best aproch IMHO is to redirect stdout and stderr in 2 files, like that :
ftp_log=log
ftp_error_log_err_log
scp -v "$feedFile" $USER@${destination}:inbox > "$ftp_log" 2> "$ftp_error_log"
Upvotes: 0