mc-backup now stops server and outputs tar.ztd to stdout

this is motivated by wanting to redirect the world/server files
after provisioning, according to user config.

.hushlogin was added to root's home dir as to not interfere with
directly piping ssh's mc-backup output to a file
This commit is contained in:
ida schmidt 2025-03-30 22:56:12 +01:00
parent e284bb605d
commit 4f79143cba

View file

@ -23,7 +23,7 @@ fi
echo "preparing..." # making sure things have the right owners
adduser --disabled-password --gecos "" mc
mkdir -p /srv/minecraft/{server,backups}
mkdir -p /srv/minecraft/server
cat <<- 'EOF' > /etc/systemd/system/mc-server.service
[Unit]
Description=Minecraft server
@ -46,7 +46,8 @@ echo "PATH=/root/.local/bin/:$PATH" >> /root/.bashrc #FIXME: needs to me made im
cat <<- 'EOF' > /root/.local/bin/mc-backup
#!/usr/bin/env bash
tar -caf /srv/minecraft/backups/server.tar.xz /srv/minecraft/server/
systemctl stop mc-server
tar -c -f - /srv/minecraft/server/ | zstd
EOF
chown root:root /root/.local/bin/mc-backup