Minor formatting
This commit is contained in:
parent
2275971453
commit
2aa5d0fd5d
30
borgBK.sh
30
borgBK.sh
@ -37,28 +37,28 @@ case $HOSTNAME in
|
||||
(gamesrv)
|
||||
# Backup /home and minecraft srvs (in /opt/minecraft)
|
||||
# Loop through all servers
|
||||
dirs=(/opt/minecraft/*)
|
||||
dirs=(/opt/minecraft/*)
|
||||
for dir in "${dirs[@]}"
|
||||
do
|
||||
# Get just the name, not path for systemd unit
|
||||
# Get just the name, not path for systemd unit
|
||||
dir=${dir//"/opt/minecraft/"}
|
||||
# If running, stop the server
|
||||
# Note: systemd unit properly handles the save-all and graceful stop of the server.
|
||||
# If running, stop 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
|
||||
# Note: Added the specific start/stop for each server to sudoers for nopass
|
||||
sudo systemctl stop minecraft@$dir.service
|
||||
mkdir -p ~/minecraft_copies
|
||||
cp -r /opt/minecraft/$dir ~/minecraft_copies
|
||||
sudo systemctl start minecraft@$dir.service
|
||||
else
|
||||
# Otherwise, just copy
|
||||
mkdir -p ~/minecraft_copies
|
||||
cp -r /opt/minecraft/$dir ~/minecraft_copies
|
||||
# Note: Added the specific start/stop for each server to sudoers for nopass
|
||||
sudo systemctl stop minecraft@$dir.service
|
||||
mkdir -p ~/minecraft_copies
|
||||
cp -r /opt/minecraft/$dir ~/minecraft_copies
|
||||
sudo systemctl start minecraft@$dir.service
|
||||
else
|
||||
# Otherwise, just copy
|
||||
mkdir -p ~/minecraft_copies
|
||||
cp -r /opt/minecraft/$dir ~/minecraft_copies
|
||||
fi
|
||||
done
|
||||
|
||||
# Loop through all factorio servers
|
||||
dirs=(/opt/factorio/*)
|
||||
# Loop through all factorio servers
|
||||
dirs=(/opt/factorio/*)
|
||||
for dir in "${dirs[@]}"
|
||||
do
|
||||
# Get just the name, not path for systemd unit
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user