r632 - html/trunk/external-scripts

justin at linuxfromscratch.org justin at linuxfromscratch.org
Tue Nov 1 11:32:05 PST 2005


Author: justin
Date: 2005-11-01 12:32:05 -0700 (Tue, 01 Nov 2005)
New Revision: 632

Added:
   html/trunk/external-scripts/blfs-ftp-rsync.sh
Log:
Added blfs-ftp-rsync.sh sample script.

Copied: html/trunk/external-scripts/blfs-ftp-rsync.sh (from rev 631, html/trunk/external-scripts/lfs-ftp-rsync.sh)
===================================================================
--- html/trunk/external-scripts/lfs-ftp-rsync.sh	2005-11-01 18:49:49 UTC (rev 631)
+++ html/trunk/external-scripts/blfs-ftp-rsync.sh	2005-11-01 19:32:05 UTC (rev 632)
@@ -0,0 +1,24 @@
+#!/bin/sh
+# This script rsyncs a directory with a server and will log and mail the
+# output to a user. 
+# Parameters are needed in this order:
+
+NAME="BLFS FTP Archive"
+SITE=rsync.osuosl.org
+MODULE=blfs
+LOCAL=/local/path/				# Edit this line
+LOG=/tmp/blfs_rsync-`date +%Y%m%d%H%M%S`	# Edit this line, if necessary
+USER=your at email.address				# Edit this line
+MAILER=/usr/sbin/sendmail			# Edit this line, if necessary
+
+OUTPUT=`rsync -lprtz --delete ${SITE}::${MODULE} ${LOCAL} 2>&1`
+
+if [ $? = 0 ]
+then
+    echo -e "Subject: rsync of ${NAME} OK\n" |${MAILER} ${USER};
+    echo "Rsync of ${NAME} succeeded on" `date` >> ${LOG}
+else
+    (echo -e "Subject: rsync of ${NAME} FAILED\n"; echo -e "${OUTPUT}") |${MAILER} ${USER};
+    echo "Rsync of ${NAME} failed on" `date` >> ${LOG};
+    echo -e "${OUTPUT}" >> ${LOG}
+fi




More information about the website mailing list