From: Zoltán Felleg Date: Tue, 6 Apr 2021 13:53:24 +0000 (+0200) Subject: Updated vhost{1, 2}.in (added shutdown commands to temperature.sh script). X-Git-Url: http://git.useribm.hu/?a=commitdiff_plain;h=6671ffd0260991318ea77fcc23f358240afc9670;p=user-lxc.git Updated vhost{1, 2}.in (added shutdown commands to temperature.sh script). --- diff --git a/sources/vhost1.in/root/temperature.sh b/sources/vhost1.in/root/temperature.sh index e0fa5f2..b4e99d9 100755 --- a/sources/vhost1.in/root/temperature.sh +++ b/sources/vhost1.in/root/temperature.sh @@ -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 diff --git a/sources/vhost2.in/root/temperature.sh b/sources/vhost2.in/root/temperature.sh index e0fa5f2..b4e99d9 100755 --- a/sources/vhost2.in/root/temperature.sh +++ b/sources/vhost2.in/root/temperature.sh @@ -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