From 7fe914ad7cf6609bb0340e13ac3941d83fd09d64 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Zolt=C3=A1n=20Felleg?= Date: Tue, 1 Dec 2020 14:56:04 +0100 Subject: [PATCH] Updated vhost{1, 2}.usr (temperature script). --- sources/vhost1.usr/root/temperature.cfg | 1 + sources/vhost1.usr/root/temperature.sh | 16 ++++++++-------- sources/vhost2.usr/root/temperature.cfg | 1 + sources/vhost2.usr/root/temperature.sh | 16 ++++++++-------- 4 files changed, 18 insertions(+), 16 deletions(-) diff --git a/sources/vhost1.usr/root/temperature.cfg b/sources/vhost1.usr/root/temperature.cfg index 4193cab..dc4ec04 100644 --- a/sources/vhost1.usr/root/temperature.cfg +++ b/sources/vhost1.usr/root/temperature.cfg @@ -4,6 +4,7 @@ MODEM_IP="192.168.8.1" PHONES=("+36209541513" "+36309502529" "+36309775888" "+36704581234") NUMBER_OF_PHONES=4 +# csgulyas fschnell rrendek mszabo HEARTBEAT_PHONES=("+36303744065" "+36309502529" "+36309775888" "+36704581234") NUMBER_OF_HEARTBEAT_PHONES=4 diff --git a/sources/vhost1.usr/root/temperature.sh b/sources/vhost1.usr/root/temperature.sh index ee8b7d0..e7438cc 100755 --- a/sources/vhost1.usr/root/temperature.sh +++ b/sources/vhost1.usr/root/temperature.sh @@ -11,10 +11,10 @@ source $SCRIPT_CONFIG delete_logs() { - LOG_COUNT=$(ls /tmp/temperature-????????.log | wc -l) + LOG_COUNT=$(ls /var/log/temperature-????????.log | wc -l) if [ $LOG_COUNT -gt 14 ] then - FIRST_LOG=$(ls /tmp/temperature-????????.log | head -n 1) + FIRST_LOG=$(ls /var/log/temperature-????????.log | head -n 1) rm -f $FIRST_LOG fi } @@ -100,7 +100,7 @@ log_temperature() { STR_DATE=$(date) - echo "${STR_DATE}: ${MESSAGE_TYPE}: $TEMPERATURE" | tee -a /tmp/temperature-${PRG_DATE}.log + echo "${STR_DATE}: ${MESSAGE_TYPE}: $TEMPERATURE" | tee -a /var/log/temperature-${PRG_DATE}.log } send_heartbeat_sms() { @@ -189,15 +189,15 @@ fi log_temperature $MESSAGE_TYPE $TEMPERATURE -if [ -f $SCRIPT_STOP ] +DAY_HOUR_MINUTE=$(date "+%u%H%M") +if [ "$DAY_HOUR_MINUTE" == "11000" ] then - exit 0 + send_heartbeat_sms $MESSAGE_TYPE $TEMPERATURE fi -DAY_HOUR_MINUTE=$(date "+%u%H%M") -if [ "$DAY_HOUR_MINUTE" == "21000" ] +if [ -f $SCRIPT_STOP ] then - send_heartbeat_sms $MESSAGE_TYPE $TEMPERATURE + exit 0 fi MINUTE_LASTDIGIT=$(date "+%M" | cut -c 2) diff --git a/sources/vhost2.usr/root/temperature.cfg b/sources/vhost2.usr/root/temperature.cfg index 4193cab..dc4ec04 100644 --- a/sources/vhost2.usr/root/temperature.cfg +++ b/sources/vhost2.usr/root/temperature.cfg @@ -4,6 +4,7 @@ MODEM_IP="192.168.8.1" PHONES=("+36209541513" "+36309502529" "+36309775888" "+36704581234") NUMBER_OF_PHONES=4 +# csgulyas fschnell rrendek mszabo HEARTBEAT_PHONES=("+36303744065" "+36309502529" "+36309775888" "+36704581234") NUMBER_OF_HEARTBEAT_PHONES=4 diff --git a/sources/vhost2.usr/root/temperature.sh b/sources/vhost2.usr/root/temperature.sh index ee8b7d0..e7438cc 100755 --- a/sources/vhost2.usr/root/temperature.sh +++ b/sources/vhost2.usr/root/temperature.sh @@ -11,10 +11,10 @@ source $SCRIPT_CONFIG delete_logs() { - LOG_COUNT=$(ls /tmp/temperature-????????.log | wc -l) + LOG_COUNT=$(ls /var/log/temperature-????????.log | wc -l) if [ $LOG_COUNT -gt 14 ] then - FIRST_LOG=$(ls /tmp/temperature-????????.log | head -n 1) + FIRST_LOG=$(ls /var/log/temperature-????????.log | head -n 1) rm -f $FIRST_LOG fi } @@ -100,7 +100,7 @@ log_temperature() { STR_DATE=$(date) - echo "${STR_DATE}: ${MESSAGE_TYPE}: $TEMPERATURE" | tee -a /tmp/temperature-${PRG_DATE}.log + echo "${STR_DATE}: ${MESSAGE_TYPE}: $TEMPERATURE" | tee -a /var/log/temperature-${PRG_DATE}.log } send_heartbeat_sms() { @@ -189,15 +189,15 @@ fi log_temperature $MESSAGE_TYPE $TEMPERATURE -if [ -f $SCRIPT_STOP ] +DAY_HOUR_MINUTE=$(date "+%u%H%M") +if [ "$DAY_HOUR_MINUTE" == "11000" ] then - exit 0 + send_heartbeat_sms $MESSAGE_TYPE $TEMPERATURE fi -DAY_HOUR_MINUTE=$(date "+%u%H%M") -if [ "$DAY_HOUR_MINUTE" == "21000" ] +if [ -f $SCRIPT_STOP ] then - send_heartbeat_sms $MESSAGE_TYPE $TEMPERATURE + exit 0 fi MINUTE_LASTDIGIT=$(date "+%M" | cut -c 2) -- 2.54.0