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
"$rsynccommandline >$logfile 2>&1" is one way - use however many "v"s you need. If you want to accumulate the output of several invocations, "$rsynccommandline >>$logfile 2>&1" If you really want it in syslog "$rsynccommandline 2>&1 |logger $facility.$severity", and make sure you have syslog configured to put that where you want it. Tim Conway Unix System Administration Contractor - IBM Global Services desk:3032734776 conway@us.ibm.com "T. Coutu" <coutu3@CyberCraftCorp.com> Sent by: rsync-bounces+conway=us.ibm.com@lists.samba.org 03/23/2004 10:53 AM Please respond to coutu3 To rsync@lists.samba.org cc 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
We always run rsync from a shell script, sometimes we pipe the shell script output to mailx or such. I'm sure you can write it to a log file but don't recall the syntax off hand. We never run the single command as a cron task, ie never 0 23 * * 1-5 rsync but do 0 23 * * 1-5 script1.sh I'm sure a number of the OS provided root cron jobs do so. [Charset KOI8-R unsupported, filtering to ASCII...]> 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 >
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" XX@XX.XX 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" XX@XX.XX 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" xxx@xxx.xxx rsync-log-maint HOMEDIR=/Library/Logs RECIPS=xx@xx.xx # 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:coutu3@CyberCraftCorp.com] Sent: Tuesday, March 23, 2004 5:53 PM To: rsync@lists.samba.org 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. ***********************************************************************************
Reasonably Related Threads
- Rsync killed my server
- Newbie: What does -e do?
- [CentOS 5] tftp-server, unable to create new files (even with "-c" option)
- Rsync order of maginitude slower with twice as large directory
- Cisco 79xx users/consultants, 7970G color in particular share information