Skip to content

Instantly share code, notes, and snippets.

@gdamjan
Last active March 21, 2025 17:47
Show Gist options
  • Select an option

  • Save gdamjan/cc3a65cf9afa5fd7645c to your computer and use it in GitHub Desktop.

Select an option

Save gdamjan/cc3a65cf9afa5fd7645c to your computer and use it in GitHub Desktop.
script to rsync from an arch mirror
[Unit]
Description=Mirror arch linux
[Service]
Type=oneshot
ExecStart=/home/arch/sync_arch_mirror.sh
User=arch
[Unit]
Description=Mirror arch almost every two hours
[Timer]
OnBootSec=15min
OnUnitActiveSec=2h10m
AccuracySec=10min
[Install]
WantedBy=timers.target
#! /bin/bash
set -e
REPO=rsync://mirror.de.leaseweb.net/archlinux/
DEST=/home/arch/public_html/archlinux/
# Common rsync options
RSYNC_OPTS="-rtlH -4 --safe-links --no-motd"
# Only be verbose on tty
if tty -s; then
RSYNC_OPTS="$RSYNC_OPTS -v"
fi
# first get new package files (the pool)
/usr/bin/rsync $RSYNC_OPTS $REPO/pool/ $DEST/pool/
# … and only then get the database, links and the structure
/usr/bin/rsync $RSYNC_OPTS --delete-after --delay-updates $REPO $DEST
@gdamjan
Copy link
Author

gdamjan commented Jul 25, 2015

Any output goes the journal, so no redirection and stuff

@gdamjan
Copy link
Author

gdamjan commented Oct 24, 2017

Oct 24 14:10:55 mk.arch.mirror systemd[1]: Starting Mirror arch linux...
Oct 24 14:11:27 mk.arch.mirror systemd[1]: Started Mirror arch linux.
Oct 24 14:11:27 mk.arch.mirror systemd[1]: arch-mirror.service: Received 149.1M IP traffic, sent 1.5M IP traffic

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment