Skip to content

Instantly share code, notes, and snippets.

@JakeDEvans
Created May 14, 2019 15:55
Show Gist options
  • Save JakeDEvans/b831cbdd6d72131adbf42a47a4619fb4 to your computer and use it in GitHub Desktop.
Save JakeDEvans/b831cbdd6d72131adbf42a47a4619fb4 to your computer and use it in GitHub Desktop.
#!/usr/bin/env sh
# make sure we never run 2 rsync at the same time
lockfile="/tmp/alpine-mirror-v3.9.lock"
if [ -z "$flock" ] ; then
exec env flock=1 flock -n $lockfile "$0" "$@"
fi
src=rsync://rsync.alpinelinux.org/alpine/v3.9/
dest=/var/www/localhost/htdocs/alpine/v3.9/
mkdir -p "$dest"
/usr/bin/rsync \
--archive \
--update \
--hard-links \
--delete \
--delete-after \
--delay-updates \
--timeout=600 \
"$src" "$dest"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment