This script, residing on the debian5vm Final Exam virtual machine, downloads an entire copy of the ~jeremy web site from the csrh1 machine (which, in turn, should contain a copy of the same from the SDF freeshell machine).
The overall theory of operation is:
Click here to view the transcript of the latest rsync download. (Viewable on debian5vm machine only.)
1 #!/bin/bash 2 # getdog.sh 3 # L. J. Jaeckel -- April 21, 2011 4 5 # Run rsync to pull entire directory of web site files from 6 # jaeckell@csrh1.yosemite.edu:/home/jaeckell/Dogweb to 7 # local directory /home/jeremy/Testweb. 8 # Then copy all the files from there into ~jeremy/public_html 9 # 10 # This runs with public key authentication, and so can be run 11 # automatically as a cron, without need for manual password entry. 12 13 REMOTE_USER=jaeckell 14 REMOTE_MACH=csrh1.yosemite.edu 15 # Note, remote directory name includes / at the end. 16 # We discovered that this is necessary to make it work right. 17 REMOTE_DIR=/home/jaeckell/Dogweb/ 18 19 LOCAL_HOME=/home/jeremy 20 LOCAL_DIR=$LOCAL_HOME/Testweb 21 LOCAL_HTML=$LOCAL_HOME/public_html 22 LOCAL_KEY=$LOCAL_HOME/cron/debian5vm-rsync-key 23 24 cd $LOCAL_HOME 25 echo '<html><head><title>Doggie download on' `date` '</title></head>' 26 echo '<body><h2>Doggie web site download started on:' `date` '</h2>' 27 28 echo "<h3>Downloading modified files from $REMOTE_MACH" 29 echo "to local directory $LOCAL_DIR</h3>" 30 echo '<pre>' 31 32 echo rsync -arvz -e "\"ssh -i $LOCAL_KEY\"" $REMOTE_USER@$REMOTE_MACH:$REMOTE_DIR $LOCAL_DIR 33 rsync -arvz -e "ssh -i $LOCAL_KEY" $REMOTE_USER@$REMOTE_MACH:$REMOTE_DIR $LOCAL_DIR 34 35 echo '</pre>' 36 echo "<h3>Copying entire web file collection from local $LOCAL_DIR<br />" 37 echo "to local web site directory $LOCAL_HTML</h3>" 38 echo '<pre>' 39 40 cd $LOCAL_DIR 41 cp -f -v -r * $LOCAL_HTML 42 cd $LOCAL_HOME 43 44 echo '</pre>' 45 echo '<h2>Doggie web site download completed on: ' `date` '</h2><hr /></body></html>' 46 47