From 2aa5d0fd5d771f4f32361acbec131f16c884b111 Mon Sep 17 00:00:00 2001 From: noah Date: Sun, 24 Sep 2023 16:11:35 -0500 Subject: [PATCH] Minor formatting --- borgBK.sh | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/borgBK.sh b/borgBK.sh index e1b2ac1..0ec4a21 100755 --- a/borgBK.sh +++ b/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