#!/bin/sh # In this case, it runs a script to use rsync to copy files from the directory /etc/distrib on the server (baskerville, for now) to /etc/distrib on the client. While rsync can run over ssh, we first need to check that the ssh config files are up-to-date. So the first part of the script handles copying the files in /etc/distrib/ssh, and then the script copies everything else in /etc/distrib over ssh: # # Script for pulling system administration files from a server via anonymous # rsync over ssh # PATH=/bin:/usr/bin RSYNC=/usr/local/bin/rsync RSYNCPATH=/usr/local/bin/rsync SERVER=baskerville DIR=/etc/distrib SSHPATH=/usr/local/bin/ssh if [ -x $RSYNC ]; then # # First get the ssh config and known hosts files # umask 022; mkdir -p $DIR/ssh $RSYNC --archive --rsync-path $RSYNCPATH --timeout 30 $SERVER::ssh $DIR/ssh if [ $? = 0 ]; then if [ -s $DIR/ssh/ssh_config ]; then rm -f /etc/ssh_config ln -s /etc/distrib/ssh/ssh_config /etc/ssh_config fi if [ -s $DIR/ssh/sshd_config ]; then rm -f /etc/sshd_config ln -s /etc/distrib/ssh/sshd_config /etc/sshd_config fi if [ -s $DIR/ssh/ssh_known_hosts ]; then rm -f /etc/ssh_known_hosts ln -s /etc/distrib/ssh/ssh_known_hosts /etc/ssh_known_hosts fi # # Now we can use rsync over ssh for the rest # $RSYNC --archive --exclude ssh --rsh $SSHPATH --rsync-path $RSYNCPATH --timeout 30 $SERVER::distrib $DIR fi fi