RE: Rsync command and verbose log



If I can suggest a more friendly date..

#!/bin/bash
DATE=$(date +%Y-%m-%d) will output: 2010-04-29




Regards

-----Original Message-----
From: ubuntu-users-bounces@xxxxxxxxxxxxxxxx
[mailto:ubuntu-users-bounces@xxxxxxxxxxxxxxxx] On Behalf Of Richard
Mancusi
Sent: Thursday, April 29, 2010 1:41 PM
To: Ubuntu user technical support,not for general discussions
Subject: Re: Rsync command and verbose log

On Thu, Apr 29, 2010 at 12:20, Vijay Shanker Dubey
<vijay.shad@xxxxxxxxx> wrote:
Hi,
I am creating a script to sync my important documents between two
system. I
want my script to generate a log file for the last action. can you
suggest
me a way to achieve this.
Question: If I execute the rsync command with -v flag, it will print a
lot
of messages on the console. Is there any way. So, I can redirect these
logs
to a file?

Regards,
Vijay Shanker Dubey


write a script something like this:
(yes I know some of the flags are redundant)
replace the <> with your data
last 2 echos simply place 2 blank lines between one log
entry and the next

#!/bin/bash
DATE=`date`
echo $DATE BackUp Started: <your source> to <your destination> >> <log
file name>
rsync -e ssh -raPH -v >> <log file name> --delete <data to copy> <ip>:
rsync -e ssh -raPH -v >> <log file name> --delete <more data to copy>
<ip>:
rsync -e ssh -raPH -v >> <log file name> --delete <more data to copy>
<ip>:
rsync -e ssh -raPH -v >> <log file name> --delete <more data to copy>
<ip>:

echo $DATE BackUp Finished: <your source> to <your destination> >>
<log file name>
echo >> <log file name>
echo >> <log file name>

--
ubuntu-users mailing list
ubuntu-users@xxxxxxxxxxxxxxxx
Modify settings or unsubscribe at:
https://lists.ubuntu.com/mailman/listinfo/ubuntu-users

--
ubuntu-users mailing list
ubuntu-users@xxxxxxxxxxxxxxxx
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users



Relevant Pages

  • Re: Rsync command and verbose log
    ... Karan Grover ... On Thu, Apr 29, 2010 at 10:50 PM, Vijay Shanker Dubey ... I am creating a script to sync my important documents between two system. ... want my script to generate a log file for the last action. ...
    (Ubuntu)
  • Re: rsync most recent files from large source
    ... But you might wanna look into the -a flag anyway. ... rsync behaves quite differently with the slashes involved. ... BTW, you might want to see -n/--dry-run options to the rsync command, would let you do a dummy run of the command and to see what is being synced/updated/deleted/created before the actual sync is run. ...
    (comp.unix.shell)