openmamba-headserver-tools/etc/cron.hourly/10-openmamba-sync-back

52 lines
1.7 KiB
Plaintext
Raw Normal View History

2012-03-12 15:18:41 +01:00
#!/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
[[ "`/usr/bin/tty`" != "not a tty" ]] && echo "==> Syncing back $rep remote repository"
2012-03-12 15:18:41 +01:00
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
2012-03-12 15:18:41 +01:00
done
rsync \
$RSYNC_OPT \
$dest_rsync/$rep/SRPMS.base $local_ftp/$rep \
--password-file=/etc/rsync.password --bwlimit=500 \
--exclude old >/dev/null
2012-03-12 15:18:41 +01:00
rsync \
$RSYNC_OPT \
$dest_rsync/$rep/home $local_ftp/$rep \
--password-file=/etc/rsync.password --bwlimit=500 \
--exclude old > /dev/null
2012-03-12 15:18:41 +01:00
# 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
[[ "`/usr/bin/tty`" != "not a tty" ]] && echo "==> Syncing back remote $a repository"
2012-03-12 15:18:41 +01:00
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
}