23 | | == The Rsync Script == |
24 | | |
25 | | {{{ |
26 | | #!/bin/sh |
27 | | # This script rsyncs a directory with a server and will log and mail the |
28 | | # output to a user. |
29 | | # Parameters are needed in this order: |
30 | | |
31 | | NAME="CLFS FTP Archive" |
32 | | SITE=rsync.osuosl.org |
33 | | MODULE=clfs |
34 | | LOG=/var/log/clfs_rsync |
35 | | LOCAL=/local/path/ # Edit this line |
36 | | USER=your@email.address # Edit this line |
37 | | MAILER=/usr/sbin/sendmail # Edit this line, if necessary |
38 | | |
39 | | OUTPUT=`rsync -lprtz --delete ${SITE}::${MODULE} ${LOCAL} 2>&1` |
40 | | |
41 | | if [ $? = 0 ] ; then |
42 | | echo -e "Subject: rsync of ${NAME} OK\n" |${MAILER} ${USER}; |
43 | | echo "Rsync of ${NAME} succeeded on" `date` >> ${LOG} |
44 | | else |
45 | | (echo -e "Subject: rsync of ${NAME} FAILED\n"; echo -e "${OUTPUT}") |${MAILER} ${USER}; |
46 | | echo "Rsync of ${NAME} failed on" `date` >> ${LOG}; |
47 | | echo -e "${OUTPUT}" >> ${LOG} |
48 | | fi |
49 | | }}} |
| 23 | He will then get back to you with the rsync script you need any can offer help with any questions you have. |