can scp output be redirected to a file
Hi all,
I have two linux boxes in my network,and they can transfer files through scp without password through ssh key. My question is,if i run scp file dinesh@192.168.14.5:/home/dinesh 2&> log Nothing is registered in log.I want this to be registered because this scp operation is done via cron.so that i can check with the log file if the operation is stopped due to network connectivity or power shut down. so is it possible to redirect the scp output to a file. Your suggestion please. Thanks in advance, Dinesh. |
write the redirection like this:
Code:
scp file dinesh@192.168.14.5:/home/dinesh 2>&1 > log |
Try >log 2>&1
|
Hi acid and catkin,
Thanks for your replies,but that didn't worked for me.Still nothing is written in the log file. |
Quote:
|
this doesn't work in a cron job or on a command line? If it's just a cron, then you'll want to put the full path to the scp binary and run it via bash, not directly.
|
Hi sloob,
Thanks, i will use scp with -v option,but still i could not get the scp output to the log file. This is the scp output,when i run "scp file dinesh@192.168.14.5:/home/dinesh" file 100% 155 0.2KB/s 00:00 and i want this to be written in the log file,is that possible. |
if you have the choice,.. use 'rsync'
Code:
rsync -varh --progress /from/tmp/ root@192.168.1.1:/to/tmp/ 2>&1 > output.log |
if that redirection is being entered correctly, as above, it will be.
|
Hi acid,
As i mentioned in my previous post, This is the scp output,when i run "scp file dinesh@192.168.14.5:/home/dinesh" file 100% 155 0.2KB/s 00:00 and i want this to be written in the log file,is that possible.I have entered the redirection correctly i am sure.But still nothing is written in log file |
yes, if that redirection is being entered correctly, as above, it will be.
|
Hi,
But thats not working for me,so working on that so please share if you all find any.Thanks all for your replies. |
Quote:
|
All times are GMT -5. The time now is 08:38 AM. |