# Copy the newest verified snapshot off the box (rsync to OFFSITE_DEST). Started by upstream-offsite.timer, or by hand: # systemctl start upstream-offsite. Does NOTHING until OFFSITE_DEST is set in /etc/upstream/upstream.env: the ExecCondition # below then makes systemd skip the run quietly (no failure). See docs/DEPLOY.md section 7, "Off-box copy". # # install -m 0644 deploy/upstream-offsite.service deploy/upstream-offsite.timer /etc/systemd/system/ # (after configuring) systemctl daemon-reload && systemctl enable --now upstream-offsite.timer # # Instead of the timer you can chain it to the backup: `systemctl edit upstream-backup` and add # [Unit] # OnSuccess=upstream-offsite.service [Unit] Description=Upstream - copy the newest verified snapshot off the box Documentation=file:///opt/upstream/docs/DEPLOY.md # Not tied to upstream.service: copying a snapshot must work while the game is stopped. [Service] Type=oneshot User=upstream Group=upstream WorkingDirectory=/opt/upstream # OFFSITE_DEST, OFFSITE_METHOD, OFFSITE_SSH_KEY, OFFSITE_KNOWN_HOSTS, OFFSITE_SSH_OPTS, BACKUP_DIR: see deploy/upstream-offsite. EnvironmentFile=-/etc/upstream/upstream.env Environment=BACKUP_DIR=/var/lib/upstream/backups Environment=UPSTREAM_ADMIN=/usr/local/bin/upstream-admin # Exit 1 from ExecCondition = skipped (not failed) when OFFSITE_DEST is unset or empty. ExecCondition=/opt/upstream/deploy/upstream-offsite --check ExecStart=/opt/upstream/deploy/upstream-offsite # A failed copy must be visible: the unit fails and journalctl -u upstream-offsite shows why. TimeoutStartSec=30min Nice=10 IOSchedulingClass=idle NoNewPrivileges=yes CapabilityBoundingSet= AmbientCapabilities= # ssh/rsync need IP sockets; AF_UNIX for an ssh-agent or the resolver, AF_NETLINK for glibc's resolver (as in upstream.service) RestrictAddressFamilies=AF_INET AF_INET6 AF_UNIX AF_NETLINK RestrictRealtime=yes RestrictSUIDSGID=yes LockPersonality=yes SystemCallArchitectures=native UMask=0077