Skip to content

Instantly share code, notes, and snippets.

@mjf
Created September 11, 2014 06:11
Show Gist options
  • Save mjf/9ae88cd685f076a36483 to your computer and use it in GitHub Desktop.
Save mjf/9ae88cd685f076a36483 to your computer and use it in GitHub Desktop.
Systemd units to mirror CentOS v7.0.1406 (excluding ISOs) every 30 minutes using RSync
[Unit]
Description=Mirror CentOS v7.0.1406 to /srv/mirrors/centos/7.0.1406
Wants=network-online.target
RefuseManualStart=true
RefuseManualStop=true
[Service]
Type=simple
User=mirrors
Group=mirrors
UMask=027
IOSchedulingClass=best-effort
IOSchedulingPriority=3
CPUSchedulingPolicy=rr
CPUSchedulingPriority=70
Nice=-5
PIDFile=/var/run/mirror-centos-7.0.1406.pid
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=mirror-centos-7.0.1406
SyslogFacility=daemon
SyslogLevel=err
NoNewPrivileges=true
ExecStart=/usr/bin/rsync --quiet --archive --delete --delete-excluded --exclude isos rsync://mirrors.kernel.org/mirrors/centos/7.0.1406 /srv/mirrors/centos
[Install]
WantedBy=multi-user.target
[Unit]
Description=Timer for mirror-centos-7.0.1406.service Systemd unit
[Timer]
OnBootSec=5min
OnUnitActiveSec=30min
Unit=mirror-centos-7.0.1406.service
[Install]
WantedBy=timers.target
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment