shellcheck suggesties

This commit is contained in:
2023-09-24 14:58:06 +02:00
parent 0d13eb2f16
commit 2abc9028fb

View File

@@ -10,11 +10,11 @@ REST=("dt03" "git01" "run01" "has01" "iam01" "man01" "mdm01" "minecraft" "nms01"
############################################ ############################################
# 1:00h (uit crontab) FIRST # # 1:00h (uit crontab) FIRST #
############################################ ############################################
for SERVER in ${FIRST[@]}; do for SERVER in "${FIRST[@]}"; do
echo "------------------------------------" echo "------------------------------------"
date +"%H:%M:%S %d-%m-%Y" date +"%H:%M:%S %d-%m-%Y"
echo Starting reboot of $SERVER echo "Starting reboot of $SERVER"
ssh $SERVER reboot now ssh "$SERVER" reboot now
sleep 60 sleep 60
done done
@@ -23,15 +23,15 @@ done
############################################ ############################################
timeNow=$(date +%s) timeNow=$(date +%s)
targetTime=$(date -d 01:15 +%s) targetTime=$(date -d 01:15 +%s)
timeToWait=$(($targetTime - $timeNow)) timeToWait=($targetTime - $timeNow)
echo Waiting $timeToWait seconds echo "Waiting $timeToWait seconds"
sleep $timeToWait sleep "$timeToWait"
for SERVER in ${SECOND[@]}; do for SERVER in "${SECOND[@]}"; do
echo "------------------------------------" echo "------------------------------------"
date +"%H:%M:%S %d-%m-%Y" date +"%H:%M:%S %d-%m-%Y"
echo Starting reboot of $SERVER echo "Starting reboot of $SERVER"
ssh $SERVER reboot now ssh "$SERVER" reboot now
sleep 60 sleep 60
done done
@@ -40,15 +40,15 @@ done
############################################ ############################################
timeNow=$(date +%s) timeNow=$(date +%s)
targetTime=$(date -d 01:30 +%s) targetTime=$(date -d 01:30 +%s)
timeToWait=$(($targetTime - $timeNow)) timeToWait=($targetTime - $timeNow)
echo Waiting $timeToWait seconds echo "Waiting $timeToWait seconds"
sleep $timeToWait sleep $timeToWait
for SERVER in ${THIRD[@]}; do for SERVER in "${THIRD[@]}"; do
echo "------------------------------------" echo "------------------------------------"
date +"%H:%M:%S %d-%m-%Y" date +"%H:%M:%S %d-%m-%Y"
echo Starting reboot of $SERVER echo "Starting reboot of $SERVER"
ssh $SERVER reboot now ssh "$SERVER" reboot now
done done
############################################ ############################################
@@ -56,15 +56,15 @@ done
############################################ ############################################
timeNow=$(date +%s) timeNow=$(date +%s)
targetTime=$(date -d 01:45 +%s) targetTime=$(date -d 01:45 +%s)
timeToWait=$(($targetTime - $timeNow)) timeToWait=($targetTime - $timeNow)
echo Waiting $timeToWait seconds echo "Waiting $timeToWait seconds"
sleep $timeToWait sleep $timeToWait
for SERVER in ${REST[@]}; do for SERVER in "${REST[@]}"; do
echo "------------------------------------" echo "------------------------------------"
date +"%H:%M:%S %d-%m-%Y" date +"%H:%M:%S %d-%m-%Y"
echo Starting reboot of $SERVER echo "Starting reboot of $SERVER"
ssh $SERVER reboot now ssh "$SERVER" reboot now
done done
############################################ ############################################
@@ -72,10 +72,10 @@ done
############################################ ############################################
timeNow=$(date +%s) timeNow=$(date +%s)
targetTime=$(date -d 01:55 +%s) targetTime=$(date -d 01:55 +%s)
timeToWait=$(($targetTime - $timeNow)) timeToWait=($targetTime - $timeNow)
echo Waiting $timeToWait seconds echo "Waiting $timeToWait seconds"
sleep $timeToWait sleep $timeToWait
echo "------------------------------------" echo "------------------------------------"
date +"%H:%M:%S %d-%m-%Y" date +"%H:%M:%S %d-%m-%Y"
echo Starting reboot of $(hostname) echo "Starting reboot of $(hostname)"
shutdown -r 5 "Reboot in 5 minutes." shutdown -r 5 "Reboot in 5 minutes."