I do the following:

####    The following line syncs the data
0,15,30,45 6-22 * * * /usr/local/bin/file_sync > /tmp/rsync-error 2>&1
####    The following runs once a day to delete added files
0 5 * * * /usr/local/bin/file_sync_delete > /tmp/rsync-error 2>&1
####    The next line monitors the sync
30 5 * * * /usr/local/bin/monitor-rsync > /dev/null 2>&1
####    This is for rotating the log files
45 5-22 * * * /usr/local/bin/rsync-log-maint > /dev/null 2>&1

file_sync

#!/bin/sh
# Be exceptionally careful when altering in any way.
#
(
echo "  "
echo "---------START--------"
date
echo "----------------------"
sudo rsync -e ssh -avz /files/ xxx.xxx.xx.xx:/files/ --eahfs
if (( $? != 0 ))
then
cat /tmp/rsync-error | mail -s "rsync-failure" [EMAIL PROTECTED]
fi
echo "---------------------"
date
echo "---------END---------"
) | tee >> /Library/Logs/rsync-log

file_sync_delete

#!/bin/sh
# Be exceptionally careful when altering in any way.
#
(
echo "  "
echo "---------START--------"
date
echo "----------------------"
sudo rsync -e ssh -avz --delete /files/ xxx.xxx.xx.xx:/files/ --eahfs
if (( $? != 0 ))
then
cat /tmp/rsync-error | mail -s "rsync-failure" [EMAIL PROTECTED]
fi
echo "---------------------"
date
echo "---------END---------"
) | tee >> /Library/Logs/rsync-log

monitor-rsync

#!/bin/sh
# File to monitor that rsync is running correctly
#
SERVER1=servername
SERVER2=servername
CHECK1=`du -sk /files/ | cut -f 1`
CHECK2=`ssh xxx.xxx.xxx.xxx du -sk /files/ | cut -f 1`
MESSAGE=`echo "CHECK SPACE USED IS SAME ON BOTH SERVERS - IF NOT PLEASE INVESTIGATE"
echo " "
echo "                 $SERVER1                $SERVER2"
echo "/files          $CHECK1 Kb              $CHECK2 Kb"`
echo "$MESSAGE" | mail -s "File Server Check" [EMAIL PROTECTED]

rsync-log-maint

HOMEDIR=/Library/Logs
[EMAIL PROTECTED]
#
cd $HOMEDIR
rm rsync-log.7
mv rsync-log.6 rsync-log.7
mv rsync-log.5 rsync-log.6
mv rsync-log.4 rsync-log.5
mv rsync-log.3 rsync-log.4
mv rsync-log.2 rsync-log.3
mv rsync-log.1 rsync-log.2
mv rsync-log.0 rsync-log.1
mv rsync-log rsync-log.0
sleep 2
tail -10 rsync-log.0 | mail -s "file_server-rsync-log" $RECIPS

Hope this helps!

-Jason



-----Original Message-----
From: T. Coutu [mailto:[EMAIL PROTECTED]
Sent: Tuesday, March 23, 2004 5:53 PM
To: [EMAIL PROTECTED]
Subject: Logging from cron


Hello,

I've just spent several hours going over several Google searches trying to find a way 
to configure rsync to log into a file named "/var/log/rsync.log".  So far, every 
instance where I've found someone asking about rsync logging remained unanswered 
(which is kind of weird in itself).

As far as I can tell, the only way to do this is to setup rsync as a daemon process so 
that it will read an rsync.confg.  The problem is that I don't want to run rsync as a 
daemon process, and am not interested in working from a rsync.confg file if I can 
avoid it.  My rsync command lines are being generated on the fly by a perl program 
running via cron, and then shelling the command to the OS (linux) and handshaking via 
SSH.  This is working fine, but I need a log to determine what is causing rsync to 
shutdown before completing the full mirror of the server.

Does anyone have any suggestions as to how I can get a log generated from rsync 
running from the command line?

Many Thanks in Advance,
Tim



-- 
To unsubscribe or change options: http://lists.samba.org/mailman/listinfo/rsync
Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html


*********************************************************************************
This e-mail message, including any attachments, is intended solely for the use of the 
addressee and may contain confidential information. 
If it is not intended for you, please inform the sender and delete the e-mail and any 
attachments immediately. Any review, retransmission, 
disclosure, copying or modification of it is strictly forbidden.  Please be advised 
that the views and opinions expressed in this e-mail may not reflect the views and 
opinions of Newsquest (Herald & Times) Limited or any of its subsidiary companies.  

Whilst we take reasonable precautions to ensure that our emails are 
free from viruses, we cannot be responsible for any viruses transmitted with this 
e-mail and recommend that you subject any incoming e-mail to your own virus checking 
procedures.  Use of this or any other e-mail facility signifies consent to any 
interception we might lawfully carry out to prevent abuse of these facilities.
***********************************************************************************

--
To unsubscribe or change options: http://lists.samba.org/mailman/listinfo/rsync
Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html

Reply via email to