Updated vhost{1, 2}.in (added shutdown commands to temperature.sh script).
authorZoltán Felleg <zoltan.felleg@userrendszerhaz.hu>
Tue, 6 Apr 2021 13:53:24 +0000 (15:53 +0200)
committerZoltán Felleg <zoltan.felleg@userrendszerhaz.hu>
Tue, 6 Apr 2021 13:53:24 +0000 (15:53 +0200)
sources/vhost1.in/root/temperature.sh
sources/vhost2.in/root/temperature.sh

index e0fa5f203045b5455eb3d63c2e173ef68fff25e1..b4e99d99f36b3f23f0e0486cb4d3f76767f8e297 100755 (executable)
@@ -5,6 +5,7 @@ SCRIPT_PATH=$(dirname $(realpath $0))
 SCRIPT_BASE=$(basename $(realpath $0) .sh)
 SCRIPT_CONFIG=$SCRIPT_PATH/${SCRIPT_BASE}.cfg
 SCRIPT_STOP=$SCRIPT_PATH/${SCRIPT_BASE}.stop
+SSH_KEYS_PATH=$SCRIPT_PATH/user-ssh
 
 
 source $SCRIPT_CONFIG
@@ -243,7 +244,25 @@ send_sms() {
 }
 
 shutdown_hosts() {
-    echo "shutting down hosts"
+    SEVERITY=$1
+
+    echo "shutting down hosts at $SEVERITY"
+    if [ $SEVERITY -le 1 ]
+    then
+        echo "shutting down store.in.useribm.hu"
+       ssh -i $SSH_KEYS_PATH/scripts -l root -o ConnectTimeout=1 store.in.useribm.hu poweroff
+        echo "shutting down tsm.in.useribm.hu"
+       ssh -i $SSH_KEYS_PATH/scripts -l root -o ConnectTimeout=1 tsm.in.useribm.hu poweroff
+    fi
+    if [ $SEVERITY -gt 1 ]
+    then
+        echo "shutting down aiac922.in.useribm.hu"
+       ssh -i $SSH_KEYS_PATH/scripts -l root -o ConnectTimeout=1 aiac922.in.useribm.hu poweroff
+        echo "shutting down store.in.useribm.hu"
+       ssh -i $SSH_KEYS_PATH/scripts -l root -o ConnectTimeout=1 store.in.useribm.hu poweroff
+        echo "shutting down tsm.in.useribm.hu"
+       ssh -i $SSH_KEYS_PATH/scripts -l root -o ConnectTimeout=1 tsm.in.useribm.hu poweroff
+    fi
 }
 
 
@@ -319,12 +338,9 @@ fi
 
 if [ $SEVERITY -gt 0 ]
 then
+    shutdown_hosts $SEVERITY
     send_sms $MESSAGE_TYPE $TEMPERATURE
 fi
-if [ $SEVERITY -gt 1 ]
-then
-    shutdown_hosts
-fi
 delete_logs
 delete_mail
 process_received_smses
index e0fa5f203045b5455eb3d63c2e173ef68fff25e1..b4e99d99f36b3f23f0e0486cb4d3f76767f8e297 100755 (executable)
@@ -5,6 +5,7 @@ SCRIPT_PATH=$(dirname $(realpath $0))
 SCRIPT_BASE=$(basename $(realpath $0) .sh)
 SCRIPT_CONFIG=$SCRIPT_PATH/${SCRIPT_BASE}.cfg
 SCRIPT_STOP=$SCRIPT_PATH/${SCRIPT_BASE}.stop
+SSH_KEYS_PATH=$SCRIPT_PATH/user-ssh
 
 
 source $SCRIPT_CONFIG
@@ -243,7 +244,25 @@ send_sms() {
 }
 
 shutdown_hosts() {
-    echo "shutting down hosts"
+    SEVERITY=$1
+
+    echo "shutting down hosts at $SEVERITY"
+    if [ $SEVERITY -le 1 ]
+    then
+        echo "shutting down store.in.useribm.hu"
+       ssh -i $SSH_KEYS_PATH/scripts -l root -o ConnectTimeout=1 store.in.useribm.hu poweroff
+        echo "shutting down tsm.in.useribm.hu"
+       ssh -i $SSH_KEYS_PATH/scripts -l root -o ConnectTimeout=1 tsm.in.useribm.hu poweroff
+    fi
+    if [ $SEVERITY -gt 1 ]
+    then
+        echo "shutting down aiac922.in.useribm.hu"
+       ssh -i $SSH_KEYS_PATH/scripts -l root -o ConnectTimeout=1 aiac922.in.useribm.hu poweroff
+        echo "shutting down store.in.useribm.hu"
+       ssh -i $SSH_KEYS_PATH/scripts -l root -o ConnectTimeout=1 store.in.useribm.hu poweroff
+        echo "shutting down tsm.in.useribm.hu"
+       ssh -i $SSH_KEYS_PATH/scripts -l root -o ConnectTimeout=1 tsm.in.useribm.hu poweroff
+    fi
 }
 
 
@@ -319,12 +338,9 @@ fi
 
 if [ $SEVERITY -gt 0 ]
 then
+    shutdown_hosts $SEVERITY
     send_sms $MESSAGE_TYPE $TEMPERATURE
 fi
-if [ $SEVERITY -gt 1 ]
-then
-    shutdown_hosts
-fi
 delete_logs
 delete_mail
 process_received_smses