Skip to content

Instantly share code, notes, and snippets.

@reedrw
Last active October 30, 2017 17:48
Show Gist options
  • Save reedrw/1d2ea9d0b1779cb144cd92bc284b0c75 to your computer and use it in GitHub Desktop.
Save reedrw/1d2ea9d0b1779cb144cd92bc284b0c75 to your computer and use it in GitHub Desktop.
#!/bin/bash
DEST='/var/www/html/archlinux'
MIRROR='rsync://mirrors.kernel.org/archlinux'
REPO='community community-staging community-testing core extra gnome-unstable iso kde-unstable multilib multilib-staging multilib-testing other pool sources testing'
function mirrorsync(){
touch lockfile
for die in $REPO; do
printf "\n\nSyncing %s...\n============================\n\n" "$die"
rsync -rtlvH --delete-after --delay-updates --copy-links --safe-links "$MIRROR"/"$die" "$DEST"
done
rm lockfile
}
if [[ -e /home/reed/daemons/lockfile ]]; then
echo "lockfile"
else
[[ -d "$DEST" ]] && mirrorsync
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment