openmamba-headserver-tools/etc/cron.hourly/10-openmamba-sync-back
2012-03-12 15:18:41 +01:00

52 lines
1.6 KiB
Bash
Executable File

#!/bin/bash
#
# openmamba repository sync-back script
# (c) 2006-2008 by Silvan Calarco <silvan.calarco@mambasoft.it>
#
. /etc/sysconfig/openmamba-central
[ "$dest_rsync" ] && {
RSYNC_OPT="-av --no-o --delete --delete-excluded"
[ "`pidof rsync`" ] && {
echo "Error: an rsync process is already running; exiting for safety."
exit 1
}
for rep in ${remote_reps[*]}; do
echo "==> Syncing back $rep remote repository"
for a in ${archs[*]}; do
rsync \
$RSYNC_OPT \
$dest_rsync/$rep/RPMS.$a $local_ftp/$rep \
--password-file=/etc/rsync.password --bwlimit=500 \
--exclude */old > /dev/null
done
rsync \
$RSYNC_OPT \
$dest_rsync/$rep/SRPMS.base $local_ftp/$rep \
--password-file=/etc/rsync.password --bwlimit=500 \
--exclude */old >/dev/null
rsync \
$RSYNC_OPT \
$dest_rsync/$rep/home $local_ftp/$rep \
--password-file=/etc/rsync.password --bwlimit=500 \
--exclude */old > /dev/null
# rsync \
# $RSYNC_OPT \
# $dest_rsync/$rep/autoupdate $local_ftp/$rep \
# --password-file=/etc/rsync.password --bwlimit=500 \
# --exclude */old > /dev/null
done
exit 0
}
[ "$ftpsync" -a "$dest_ftp" ] && {
for a in ${remote_reps[*]}; do
echo "==> Syncing back remote $a repository"
ftpsync -q -g $local_ftp/$a/RPMS.i586 \
$dest_ftp/pub/openmamba/$a/RPMS.i586 ftpuser=$ftpuser ftppasswd=$ftppass
ftpsync -q -g $local_ftp/$a/SRPMS.base \
$dest_ftp/pub/openmamba/$a/SRPMS.base ftpuser=$ftpuser ftppasswd=$ftppass
done
}