[Gllug] rsync problems

Dimitrios Siganos dimitris at siganos.org
Thu Dec 22 03:08:52 UTC 2011


On 22/12/11 02:59, sharon kimble wrote:
>> Personally, I would log the output of such a script to syslog, which means
>> it will be automatically time-stamped and log-rotated. This is how I would
>> do that:
>>
>> ---------------------------------------------------------------------------
>> ----- #!/bin/bash -x #shell script for use with rsync in user crontab
>>
>> USB_DIR="/media/8eef3b99-c17b-4913-ae61-d34c7fd5d459"
>> BACKUP_DIR="$USB_DIR/$(/bin/date +%Y%m%d)"
>> LOG="/usr/bin/logger -t my_backups"
>>
>> $LOG "Backup starting"
>> if [ -d $USB_DIR ]; then
>> 	[ -d $BACKUP_DIR ] || mkdir $BACKUP_DIR \
>> 		2>&1 | $LOG
>> 	/usr/bin/rsync -avz \
>> 		--exclude-from '/home/boztu/cron/xclude.txt' \
>> 		/home/boztu/ $BACKUP_DIR 2>&1 | $LOG
>> fi
>> $LOG "Backup finished"
>> ---------------------------------------------------------------------------
> 
> I tried this one out from the command line but when it completed I couldn't 
> find the log file! I did a sudo updatedb, and when it completed I did a locate 
> my_backups but couldn't find it anywhere on my system. Where did it go please? 

The logs are piped to "/usr/bin/logger -t my_backups".
The logger utility writes any input to the "syslog".

Where the logs end up on the filesystem, depends on your syslog
configuration but typically it will end up in /var/log/messages or
/var/log/syslog.

If you can't find them, try this:
grep -r my_backups /var/log/*

Dimitris
--
Gllug mailing list  -  Gllug at gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug




More information about the GLLUG mailing list