Rychlá refence na mirrorovací script
rsync -v -u -a --delete --rsh=ssh --stats [email protected]:/home/username/remotefile.txt ./
rsync -v -u -a --delete --rsh=ssh --stats localfile.txt [email protected]:/home/username/
Script pro mirror distribuce CentOS s využitím lock souboru:
#!/bin/bash
RSYNC="/usr/bin/rsync" # path to rsync
FLAGS="-aqzH --delete" # flags to pass to rsync
MIRROR="msync.centos.org::CentOS" # mirror url
REPO="/var/ftp/pub/centos" # location to store files
LOCKFILE="/var/lock/subsys/rsynccentos" # location of lock file
if [ -f $LOCKFILE ] # check to see if lock file exists
then
echo Lock file exists...Exiting...
exit 0
else
touch $LOCKFILE # create lock file
fi
echo Rsyncing...
$RSYNC $FLAGS $MIRROR $REPO # issue rsync command
rm -f $LOCKFILE # remove lockfile
exit 0