LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 07-06-2009, 07:08 AM   #1
ust
Senior Member
 
Registered: Mar 2003
Location: fasdf
Distribution: Debian / Suse /RHEL
Posts: 1,130

Rep: Reputation: 30
Write log


I use the below command can rsync file to it , it works fine ,

rsync -a file user@192.168.170.1:/var


then I tried rsync -a file user@192.168.170.1:/var > /tmp/log

it didn't write anything to the log , can advise if I want to log what files are copied to remote server , what can i do ? thx
 
Old 07-06-2009, 07:36 AM   #2
r0b0
Member
 
Registered: Aug 2004
Location: Europe
Posts: 608

Rep: Reputation: 50
If you did that twice in a row, then probably nothing got copied the second time. It's the way rsync works, it only copies files if they changed.

R.
 
Old 07-06-2009, 11:02 AM   #3
ust
Senior Member
 
Registered: Mar 2003
Location: fasdf
Distribution: Debian / Suse /RHEL
Posts: 1,130

Original Poster
Rep: Reputation: 30
Quote:
Originally Posted by r0b0 View Post
If you did that twice in a row, then probably nothing got copied the second time. It's the way rsync works, it only copies files if they changed.

R.
thx reply ,

if I want to have a log , can advise what can i do ? thx
 
Old 07-06-2009, 11:11 AM   #4
CSandman
Member
 
Registered: Mar 2007
Distribution: Fedora/SUSE/Debian/Knoppix
Posts: 34

Rep: Reputation: 16
Thats the right way to get the log, but if rsync didn't move anything there won't be anything in /tmp/log. If you `touch` the file (to update the timestamp) and then try it again you should find a bit of information in the log. If you still have problems try the verbose flag for rsync. `rsync -vaz file user@192.168.170.1:/var > /tmp/log` should be a bit nicer for what you're trying to do.

Another tidbit would be, if you wanted to keep a record of everytime that command was used you could use >> instead of > which would append to the log file rather than overwrite it.

Cheers.

Last edited by CSandman; 07-06-2009 at 11:13 AM.
 
Old 07-06-2009, 09:36 PM   #5
ust
Senior Member
 
Registered: Mar 2003
Location: fasdf
Distribution: Debian / Suse /RHEL
Posts: 1,130

Original Poster
Rep: Reputation: 30
thx reply ,

I tried -vaz that it will output something like speed , status , size etc , can advise if I only want to output the file name ( so that I can know which files are transferred ) , what can i do ? thx
 
Old 07-06-2009, 11:28 PM   #6
ust
Senior Member
 
Registered: Mar 2003
Location: fasdf
Distribution: Debian / Suse /RHEL
Posts: 1,130

Original Poster
Rep: Reputation: 30
Quote:
Originally Posted by ust View Post
thx reply ,

I tried -vaz that it will output something like speed , status , size etc , can advise if I only want to output the file name ( so that I can know which files are transferred ) , what can i do ? thx
if I want to output the file name that transferred , if rsync can't do it , is scp work for it ? thx
 
Old 07-07-2009, 12:20 AM   #7
CSandman
Member
 
Registered: Mar 2007
Distribution: Fedora/SUSE/Debian/Knoppix
Posts: 34

Rep: Reputation: 16
If you read the man page of rsync there is an option that lets you specify the format of the output. I believe what you're looking for is:

"rsync -arz --out-format "%n%L" srcDir destDir"

For more details use the command "man rsync"

(man uses the "less" utility so you can search for --out-format using '/' and then whatever you're searching for.)

Good luck,

CSandman
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
After log roll, Postfix cannot write to log file, Ubuntu 8.04 mboudro Linux - Server 6 09-17-2010 04:10 AM
Linux with C++ how to write my own log files kbarani Linux - Software 2 05-25-2009 10:23 AM
write mail log to /var/log/maillog jimmyjiang Red Hat 4 01-15-2008 07:18 PM
how to get a script to write to a log paul_mat Linux - Software 8 05-26-2006 07:15 AM
Write results to log? eXor Linux - Software 2 06-12-2003 02:18 PM


All times are GMT -5. The time now is 09:03 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration