Last active
December 7, 2020 23:01
-
-
Save Lartza/533c4aca60dec049967693fd6b10c7df to your computer and use it in GitHub Desktop.
RLCraft backups
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Unit] | |
Description=oneshot backup for rlcraft | |
# This can be problematic | |
#Requires=rlcraft.service | |
[Service] | |
Type=oneshot | |
User=lartza | |
Group=lartza | |
WorkingDirectory=/home/lartza | |
ExecStart=/usr/bin/bash /home/lartza/rlcraft-backup.sh | |
[Install] | |
WantedBy=multi-user.target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
cd /home/lartza | |
# Setting this, so the repo does not need to be given on the commandline: | |
export BORG_REPO=/home/lartza/rlcraft-borg | |
mcrcon -s -c -H localhost -p <RCON.PASSWORD> "say Starting world backup, world saving disabled" || true | |
mcrcon -s -c -H localhost -p <RCON.PASSWORD> save-off || true | |
mcrcon -s -c -H localhost -p <RCON.PASSWORD> save-all || true | |
sleep 5 | |
borg create \ | |
--exclude-caches \ | |
$BORG_REPO::'rlcraft-world-{now}' \ | |
/home/lartza/RLCraft/world \ | |
mcrcon -s -c -H localhost -p <RCON.PASSWORD> save-on || true | |
mcrcon -s -c -H localhost -p <RCON.PASSWORD> "say Backup finished, world saving enabled" || true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Unit] | |
Description=rlcraft backup timer | |
[Timer] | |
OnCalendar=*-*-* 1/2:00:00 | |
[Install] | |
WantedBy=timers.target |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment