Minor formatting

This commit is contained in:
Noah L. Schrick 2023-09-24 16:11:35 -05:00
parent 2275971453
commit 2aa5d0fd5d

View File

@ -37,28 +37,28 @@ case $HOSTNAME in
(gamesrv) (gamesrv)
# Backup /home and minecraft srvs (in /opt/minecraft) # Backup /home and minecraft srvs (in /opt/minecraft)
# Loop through all servers # Loop through all servers
dirs=(/opt/minecraft/*) dirs=(/opt/minecraft/*)
for dir in "${dirs[@]}" for dir in "${dirs[@]}"
do do
# Get just the name, not path for systemd unit # Get just the name, not path for systemd unit
dir=${dir//"/opt/minecraft/"} dir=${dir//"/opt/minecraft/"}
# If running, stop the server # If running, stop the server
# Note: systemd unit properly handles the save-all and graceful stop of the server. # Note: systemd unit properly handles the save-all and graceful stop of the server.
if ( systemctl is-active --quiet minecraft@$dir.service); then if ( systemctl is-active --quiet minecraft@$dir.service); then
# Note: Added the specific start/stop for each server to sudoers for nopass # Note: Added the specific start/stop for each server to sudoers for nopass
sudo systemctl stop minecraft@$dir.service sudo systemctl stop minecraft@$dir.service
mkdir -p ~/minecraft_copies mkdir -p ~/minecraft_copies
cp -r /opt/minecraft/$dir ~/minecraft_copies cp -r /opt/minecraft/$dir ~/minecraft_copies
sudo systemctl start minecraft@$dir.service sudo systemctl start minecraft@$dir.service
else else
# Otherwise, just copy # Otherwise, just copy
mkdir -p ~/minecraft_copies mkdir -p ~/minecraft_copies
cp -r /opt/minecraft/$dir ~/minecraft_copies cp -r /opt/minecraft/$dir ~/minecraft_copies
fi fi
done done
# Loop through all factorio servers # Loop through all factorio servers
dirs=(/opt/factorio/*) dirs=(/opt/factorio/*)
for dir in "${dirs[@]}" for dir in "${dirs[@]}"
do do
# Get just the name, not path for systemd unit # Get just the name, not path for systemd unit