Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
50fc8a72b2 | ||
|
|
9183bbcef5 | ||
|
|
bdab0fb6fe | ||
|
|
6ed0510c7f | ||
|
|
15e36e95a3 | ||
|
|
3a5c3ef934 | ||
|
|
f3c11a7fee | ||
|
|
ac95194b3e |
@@ -1,3 +1,10 @@
|
|||||||
|
# 0.6.1 - 06/09/2020
|
||||||
|
- Add support for send log to piGardenWeb
|
||||||
|
|
||||||
|
# 0.6.0 - 16/05/2020
|
||||||
|
- Add support for enable all cron fron api
|
||||||
|
- Update rainsensorqty driver to version 0.2.5b
|
||||||
|
|
||||||
# 0.5.14 - 24/09/2019
|
# 0.5.14 - 24/09/2019
|
||||||
- Updated rainsensorqty driver to version 0.2.3
|
- Updated rainsensorqty driver to version 0.2.3
|
||||||
- Added api and command for manage piGardenSched scheduling
|
- Added api and command for manage piGardenSched scheduling
|
||||||
|
|||||||
@@ -41,8 +41,8 @@ sudo make install
|
|||||||
|
|
||||||
``` bash
|
``` bash
|
||||||
cd
|
cd
|
||||||
git clone git://git.drogon.net/wiringPi
|
git clone https://github.com/WiringPi/WiringPi.git
|
||||||
cd wiringPi
|
cd WiringPi
|
||||||
git pull origin
|
git pull origin
|
||||||
./build
|
./build
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -2,6 +2,14 @@
|
|||||||
LOG_FILE="/home/pi/piGarden/log/piGarden.log"
|
LOG_FILE="/home/pi/piGarden/log/piGarden.log"
|
||||||
LOG_FILE_MAX_SIZE=1048576 # 1MB
|
LOG_FILE_MAX_SIZE=1048576 # 1MB
|
||||||
|
|
||||||
|
#
|
||||||
|
# Enable send log to piGardenWeb
|
||||||
|
#
|
||||||
|
|
||||||
|
#LOG_URL="http://url_of_your_pigardenweb/api/log"
|
||||||
|
#LOG_API_TOKEN="token_of_pigardenweb_user"
|
||||||
|
#LOG_CURL_PARAM="--data-urlencode -k"
|
||||||
|
|
||||||
# Log file for driver output
|
# Log file for driver output
|
||||||
LOG_OUTPUT_DRV_FILE="/tmp/piGarden.drv.log"
|
LOG_OUTPUT_DRV_FILE="/tmp/piGarden.drv.log"
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,14 @@
|
|||||||
LOG_FILE="/home/pi/piGarden/log/piGarden.log"
|
LOG_FILE="/home/pi/piGarden/log/piGarden.log"
|
||||||
LOG_FILE_MAX_SIZE=1048576 # 1MB
|
LOG_FILE_MAX_SIZE=1048576 # 1MB
|
||||||
|
|
||||||
|
#
|
||||||
|
# Enable send log to piGardenWeb
|
||||||
|
#
|
||||||
|
|
||||||
|
#LOG_URL="http://url_of_your_pigardenweb/api/log"
|
||||||
|
#LOG_API_TOKEN="token_of_pigardenweb_user"
|
||||||
|
#LOG_CURL_PARAM="--data-urlencode -k"
|
||||||
|
|
||||||
# Log file for driver output
|
# Log file for driver output
|
||||||
LOG_OUTPUT_DRV_FILE="/tmp/piGarden.drv.log"
|
LOG_OUTPUT_DRV_FILE="/tmp/piGarden.drv.log"
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,14 @@
|
|||||||
LOG_FILE="/home/pi/piGarden/log/piGarden.log"
|
LOG_FILE="/home/pi/piGarden/log/piGarden.log"
|
||||||
LOG_FILE_MAX_SIZE=1048576 # 1MB
|
LOG_FILE_MAX_SIZE=1048576 # 1MB
|
||||||
|
|
||||||
|
#
|
||||||
|
# Enable send log to piGardenWeb
|
||||||
|
#
|
||||||
|
|
||||||
|
#LOG_URL="http://url_of_your_pigardenweb/api/log"
|
||||||
|
#LOG_API_TOKEN="token_of_pigardenweb_user"
|
||||||
|
#LOG_CURL_PARAM="--data-urlencode -k"
|
||||||
|
|
||||||
# Log file for driver output
|
# Log file for driver output
|
||||||
#LOG_OUTPUT_DRV_FILE="/tmp/piGarden.drv.log"
|
#LOG_OUTPUT_DRV_FILE="/tmp/piGarden.drv.log"
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,14 @@
|
|||||||
LOG_FILE="/home/pi/piGarden/log/piGarden.log"
|
LOG_FILE="/home/pi/piGarden/log/piGarden.log"
|
||||||
LOG_FILE_MAX_SIZE=1048576 # 1MB
|
LOG_FILE_MAX_SIZE=1048576 # 1MB
|
||||||
|
|
||||||
|
#
|
||||||
|
# Enable send log to piGardenWeb
|
||||||
|
#
|
||||||
|
|
||||||
|
#LOG_URL="http://url_of_your_pigardenweb/api/log"
|
||||||
|
#LOG_API_TOKEN="token_of_pigardenweb_user"
|
||||||
|
#LOG_CURL_PARAM="--data-urlencode -k"
|
||||||
|
|
||||||
# Log file for driver output
|
# Log file for driver output
|
||||||
#LOG_OUTPUT_DRV_FILE="/tmp/piGarden.drv.log"
|
#LOG_OUTPUT_DRV_FILE="/tmp/piGarden.drv.log"
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,14 @@
|
|||||||
LOG_FILE="/home/pi/piGarden/log/piGarden.log"
|
LOG_FILE="/home/pi/piGarden/log/piGarden.log"
|
||||||
LOG_FILE_MAX_SIZE=1048576 # 1MB
|
LOG_FILE_MAX_SIZE=1048576 # 1MB
|
||||||
|
|
||||||
|
#
|
||||||
|
# Enable send log to piGardenWeb
|
||||||
|
#
|
||||||
|
|
||||||
|
#LOG_URL="http://url_of_your_pigardenweb/api/log"
|
||||||
|
#LOG_API_TOKEN="token_of_pigardenweb_user"
|
||||||
|
#LOG_CURL_PARAM="--data-urlencode -k"
|
||||||
|
|
||||||
# Log file for driver output
|
# Log file for driver output
|
||||||
#LOG_OUTPUT_DRV_FILE="/tmp/piGarden.drv.log"
|
#LOG_OUTPUT_DRV_FILE="/tmp/piGarden.drv.log"
|
||||||
|
|
||||||
|
|||||||
@@ -2,8 +2,8 @@
|
|||||||
# Driver rainsensorqty - driver for measure the rain volume
|
# Driver rainsensorqty - driver for measure the rain volume
|
||||||
# Author: androtto
|
# Author: androtto
|
||||||
# file README.md
|
# file README.md
|
||||||
# Version: 0.2.30
|
# Version: 0.2.5
|
||||||
# Data: 21/Sep/2019
|
# Data: 07/Apr/2020
|
||||||
|
|
||||||
|
|
||||||
FILE DI CONFIGURAZIONE /etc/piGarden.conf:
|
FILE DI CONFIGURAZIONE /etc/piGarden.conf:
|
||||||
@@ -37,19 +37,38 @@ nella sottodirectory command sono presenti:
|
|||||||
commands/rainsensorqty_CHECK.sh
|
commands/rainsensorqty_CHECK.sh
|
||||||
chiama la funzione di verifica pioggia, la medesima chiamata da check_rain_sensor
|
chiama la funzione di verifica pioggia, la medesima chiamata da check_rain_sensor
|
||||||
commands/rainsensorqty_HISTORY.sh
|
commands/rainsensorqty_HISTORY.sh
|
||||||
visualizza lo storico della pioggia
|
visualizza lo storico della pioggia consultando il file $RAINSENSORQTY_HISTORY
|
||||||
|
puo' essere lanciato con l''opzione -force per ricostruire il file $RAINSENSORQTY_HISTORY dal $RAINSENSORQTY_HISTORYRAW
|
||||||
|
e con un argomento X, che permette di evidenziare solo gli ultimi X eventi
|
||||||
|
commands/rainsensorqty_HISTORYRAW.sh
|
||||||
|
visualizza lo storico della pioggia consultando il file $RAINSENSORQTY_HISTORYRAW
|
||||||
|
puo' essere lanciato senza argomenti per processare l'intero file, chiede conferma visto che i tempi sono potenzialmente lunghi
|
||||||
|
con un argomento X, che permette di evidenziare solo gli ultimi X eventi
|
||||||
commands/rainsensorqty_INIT.sh
|
commands/rainsensorqty_INIT.sh
|
||||||
inizializza il driver eseguendo lo script di monitoring - normalmente tale processo avviene da piGarden.sh
|
inizializza il driver eseguendo lo script di monitoring - normalmente tale processo avviene da piGarden.sh
|
||||||
utile quando si vuole testare dei cambiamenti o se necessario riavviare dopo il kill del comando successivo
|
utile quando si vuole testare dei cambiamenti o se necessario riavviare dopo il kill del comando successivo
|
||||||
commands/rainsensorqty_KILL.sh
|
commands/rainsensorqty_KILL.sh
|
||||||
killa i processi di monitoring ed eventuali figli
|
killa i processi di monitoring ed eventuali figli
|
||||||
commands/rainsensorqty_RAINNOW.sh
|
commands/rainsensorqty_RAINNOW.sh
|
||||||
simula una pioggia registrandola in $RAINSENSORQTY_LASTRAIN
|
simula una pioggia registrandola in $RAINSENSORQTY_LASTRAIN $RAINSENSORQTY_HISTORY $RAINSENSORQTY_HISTORYRAW
|
||||||
|
puo' essere lanciato in 3 modi:
|
||||||
|
senza argomenti: genera una pioggia per un numero di loop pari al valore della variabile RAINSENSORQTY_LOOPSFORSETRAINING, quindi una pioggia completa
|
||||||
|
con un argomento: che indica quanti loop
|
||||||
|
con due argomenti: quanti loop e quanti secondi tra uno e l'altro
|
||||||
commands/rainsensorqty_REMOVELASTRAIN.sh
|
commands/rainsensorqty_REMOVELASTRAIN.sh
|
||||||
rimuove dai file $RAINSENSORQTY_LASTRAIN $RAINSENSORQTY_HISTORY l'ultima pioggia registrata
|
rimuove dai file $RAINSENSORQTY_LASTRAIN $RAINSENSORQTY_HISTORY $RAINSENSORQTY_HISTORYRAW l'ultima pioggia registrata
|
||||||
commands/rainsensorqty_RESET.sh
|
commands/rainsensorqty_RESET.sh
|
||||||
invia il SIGUSR1 al processo di monitor per resettare i cicli. Viene visualizzato il reset solo dopo il successivo PULSE, questo perche' non e' possibile per lo script ricevere il trap in quanto il processo $GPIO e' attivo in attesa del PULSE
|
invia il SIGUSR1 al processo di monitor per resettare i cicli. Viene visualizzato il reset solo dopo il successivo PULSE, questo perche' non e' possibile per lo script ricevere il trap in quanto il processo $GPIO e' attivo in attesa del PULSE
|
||||||
|
|
||||||
|
questi i timestamps alla data del file:
|
||||||
|
-rwxr-xr-x 1 pi pi 1044 Sep 24 18:26 rainsensorqty_CHECK.sh
|
||||||
|
-rwxr-xr-x 1 pi pi 1139 Nov 28 00:17 rainsensorqty_HISTORYRAW.sh
|
||||||
|
-rwxr-xr-x 1 pi pi 1462 Nov 19 00:19 rainsensorqty_HISTORY.sh
|
||||||
|
-rwxr-xr-x 1 pi pi 596 Sep 24 18:26 rainsensorqty_INIT.sh
|
||||||
|
-rwxr-xr-x 1 pi pi 1300 Sep 24 18:26 rainsensorqty_KILL.sh
|
||||||
|
-rwxr-xr-x 1 pi pi 1111 Nov 27 00:05 rainsensorqty_RAINNOW.sh
|
||||||
|
-rwxr-xr-x 1 pi pi 1252 Nov 22 00:18 rainsensorqty_REMOVELASTRAIN.sh
|
||||||
|
-rwxr-xr-x 1 pi pi 897 Sep 24 18:26 rainsensorqty_RESET.sh
|
||||||
|
|
||||||
ULTERIORI VARIABILI in config.include.sh
|
ULTERIORI VARIABILI in config.include.sh
|
||||||
----------------------------------------
|
----------------------------------------
|
||||||
@@ -65,14 +84,14 @@ RAINSENSORQTY_LASTRAIN="$STATUS_DIR/rainsensorqty_lastrain"
|
|||||||
memorizza l'ultima pioggia
|
memorizza l'ultima pioggia
|
||||||
RAINSENSORQTY_HISTORY="$STATUS_DIR/rainsensorqty_history"
|
RAINSENSORQTY_HISTORY="$STATUS_DIR/rainsensorqty_history"
|
||||||
memorizza tutte le piogge permettendo di visualizzare lo storico (commands/rainsensorqty_HISTORY.sh)
|
memorizza tutte le piogge permettendo di visualizzare lo storico (commands/rainsensorqty_HISTORY.sh)
|
||||||
|
RAINSENSORQTY_HISTORYRAW="$STATUS_DIR/rainsensorqty_history.raw"
|
||||||
|
memorizza in formato grezzo (raw) tutti gli impulsi registrati (formato: "secondi:impulsi" ) - consultabile il contenuto con commands/rainsensorqty_HISTORYRAW.sh
|
||||||
|
|
||||||
RAINSENSORQTY_MONITORLOG="$DIR_SCRIPT/log/rainsensorqty_monitor.log"
|
RAINSENSORQTY_MONITORLOG="$DIR_SCRIPT/log/rainsensorqty_monitor.log"
|
||||||
log dello script di monitoring, popolato solo se RAINSENSORQTY_verbose="yes"
|
log dello script di monitoring, popolato solo se RAINSENSORQTY_verbose="yes"
|
||||||
|
|
||||||
RAINSENSORQTY_MONPID="$TMPDIR/rainsensorqty_monitor.pid"
|
RAINSENSORQTY_MONPID="$TMPDIR/rainsensorqty_monitor.pid"
|
||||||
file che viene popolato con il pid dello script di monitoring
|
file che viene popolato con il pid dello script di monitoring
|
||||||
RAINSENSORQTY_STATE="$TMPDIR/rainsensorqty_state"
|
|
||||||
file che viene popolato con l'ultimo stato della vaschetta (formato timestamp:counter)
|
|
||||||
|
|
||||||
RAINSENSORQTY_DIR="$DIR_SCRIPT/drv/rainsensorqty"
|
RAINSENSORQTY_DIR="$DIR_SCRIPT/drv/rainsensorqty"
|
||||||
home directory del driver
|
home directory del driver
|
||||||
@@ -103,5 +122,3 @@ GPIO_RESISTOR="none" #pull-up|pull-down|none
|
|||||||
se lo stato di riposo e' 1, lo script attende la variazione verso 0 (falling)
|
se lo stato di riposo e' 1, lo script attende la variazione verso 0 (falling)
|
||||||
la variabile RAINSENSORQTY_PULSE viene impostata secondo il valore di RAIN_GPIO_STATE presente in /etc/piGarden.conf
|
la variabile RAINSENSORQTY_PULSE viene impostata secondo il valore di RAIN_GPIO_STATE presente in /etc/piGarden.conf
|
||||||
cioe' il valore che ci si aspetta per registrare il riempimento della vaschetta dello stato di pioggia
|
cioe' il valore che ci si aspetta per registrare il riempimento della vaschetta dello stato di pioggia
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -4,8 +4,8 @@
|
|||||||
# Author: androtto
|
# Author: androtto
|
||||||
# file "rainsensorqty_CHECK.sh"
|
# file "rainsensorqty_CHECK.sh"
|
||||||
# test script for checking rain status using drv_rainsensorqty_rain_sensor_get function
|
# test script for checking rain status using drv_rainsensorqty_rain_sensor_get function
|
||||||
# Version: 0.2.0a
|
# Version: 0.2.5
|
||||||
# Data: 13/Aug/2019
|
# Data: 08/Jan/2020
|
||||||
|
|
||||||
SCRIPTDIR="$(cd `dirname $0` ; pwd )"
|
SCRIPTDIR="$(cd `dirname $0` ; pwd )"
|
||||||
SCRIPTNAME=${0##*/}
|
SCRIPTNAME=${0##*/}
|
||||||
@@ -22,7 +22,38 @@ LOG_OUTPUT_DRV_FILE="$DIR_SCRIPT/log/$LOG_OUTPUT_DRV_FILE"
|
|||||||
. ./init.include.sh
|
. ./init.include.sh
|
||||||
. ./rainsensor.include.sh
|
. ./rainsensor.include.sh
|
||||||
|
|
||||||
rain_history # update rain history file if not
|
if [[ $1 = "-force" ]] ; then
|
||||||
|
if [[ -s $RAINSENSORQTY_HISTORY ]] ; then
|
||||||
|
echo backup $RAINSENSORQTY_HISTORY to ${RAINSENSORQTY_HISTORY}.old$$
|
||||||
|
cp $RAINSENSORQTY_HISTORY ${RAINSENSORQTY_HISTORY}.old$$
|
||||||
|
fi
|
||||||
|
|
||||||
echo "RAIN HISTORY"
|
echo "generate all rain events to $RAINSENSORQTY_HISTORY"
|
||||||
cat $RAINSENSORQTY_HISTORY | rain_when_amount
|
if ! rainevents > ${RAINSENSORQTY_HISTORY} ; then
|
||||||
|
echo "WARNING: rainevents function had error"
|
||||||
|
fi
|
||||||
|
shift
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! rain_history tmp ; then # update rain history with last rain if not
|
||||||
|
echo "WARNING: rain_history function had error"
|
||||||
|
fi
|
||||||
|
|
||||||
|
cmd="cat"
|
||||||
|
if [[ $# > 0 ]] ; then
|
||||||
|
if (( $1 >= 1 )) ; then
|
||||||
|
echo "processing last $1 lines of $RAINSENSORQTY_HISTORYRAW file"
|
||||||
|
cmd="tail -$1"
|
||||||
|
else
|
||||||
|
echo "argument not recognized - exit"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
echo -e "\n\n"
|
||||||
|
|
||||||
|
if [[ -s $RAINSENSORQTY_HISTORY ]] ; then
|
||||||
|
echo "RAIN HISTORY"
|
||||||
|
cat $RAINSENSORQTY_HISTORY $RAINSENSORQTY_HISTORYTMP | $cmd | rain_when_amount
|
||||||
|
else
|
||||||
|
echo "WARNING: no \$RAINSENSORQTY_HISTORY file"
|
||||||
|
fi
|
||||||
|
|||||||
50
drv/rainsensorqty/commands/rainsensorqty_HISTORYRAW.sh
Executable file
50
drv/rainsensorqty/commands/rainsensorqty_HISTORYRAW.sh
Executable file
@@ -0,0 +1,50 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
#
|
||||||
|
# Driver rainsensorqty - driver for measure the rain volume
|
||||||
|
# Author: androtto
|
||||||
|
# file "rainsensorqty_CHECK.sh"
|
||||||
|
# test script for checking rain status using drv_rainsensorqty_rain_sensor_get function
|
||||||
|
# Version: 0.2.5
|
||||||
|
# Data: 07/Apr/2020
|
||||||
|
|
||||||
|
SCRIPTDIR="$(cd `dirname $0` ; pwd )"
|
||||||
|
SCRIPTNAME=${0##*/}
|
||||||
|
cd $SCRIPTDIR/.. # command is a subdirectory of driver
|
||||||
|
|
||||||
|
DIR_SCRIPT=/home/pi/piGarden # home directory of piGarden
|
||||||
|
CONFIG_ETC="/etc/piGarden.conf"
|
||||||
|
LOG_OUTPUT_DRV_FILE="$DIR_SCRIPT/log/$LOG_OUTPUT_DRV_FILE"
|
||||||
|
|
||||||
|
. $CONFIG_ETC
|
||||||
|
|
||||||
|
. ./common.include.sh
|
||||||
|
. ./config.include.sh
|
||||||
|
. ./init.include.sh
|
||||||
|
. ./rainsensor.include.sh
|
||||||
|
|
||||||
|
|
||||||
|
if [[ $# = 0 ]] ; then
|
||||||
|
cmd=cat
|
||||||
|
echo "processing all entire $RAINSENSORQTY_HISTORYRAW file, will go on? (y/n)"
|
||||||
|
read answer
|
||||||
|
echo $answer
|
||||||
|
[[ $answer = [yY] ]] || exit 1
|
||||||
|
else
|
||||||
|
if (( $1 >= 1 )) ; then
|
||||||
|
echo "processing $1 lines of $RAINSENSORQTY_HISTORYRAW file"
|
||||||
|
cmd="tail -$1"
|
||||||
|
else
|
||||||
|
echo "argument not recognized - exit"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
echo -e "\n\n"
|
||||||
|
|
||||||
|
$cmd $RAINSENSORQTY_HISTORYRAW | while read line
|
||||||
|
do
|
||||||
|
set -- ${line//:/ }
|
||||||
|
secs=$1
|
||||||
|
counter=$2
|
||||||
|
echo "$(sec2date $1):$counter"
|
||||||
|
done
|
||||||
|
|
||||||
@@ -3,8 +3,8 @@
|
|||||||
# Author: androtto
|
# Author: androtto
|
||||||
# file "rainsensorqty_RAINNOW.sh"
|
# file "rainsensorqty_RAINNOW.sh"
|
||||||
# test script for simulate rain ... now!
|
# test script for simulate rain ... now!
|
||||||
# Version: 0.2.0a
|
# Version: 0.2.5
|
||||||
# Data: 13/Aug/2019
|
# Data: 07/Apr/2020
|
||||||
|
|
||||||
SCRIPTDIR="$(cd `dirname $0` ; pwd )"
|
SCRIPTDIR="$(cd `dirname $0` ; pwd )"
|
||||||
SCRIPTNAME=${0##*/}
|
SCRIPTNAME=${0##*/}
|
||||||
@@ -19,8 +19,49 @@ CONFIG_ETC="/etc/piGarden.conf"
|
|||||||
. ./init.include.sh
|
. ./init.include.sh
|
||||||
. ./rainsensor.include.sh
|
. ./rainsensor.include.sh
|
||||||
|
|
||||||
echo "RAIN now!"
|
wait=0
|
||||||
echo "$(date +%s):$RAINSENSORQTY_LOOPSFORSETRAINING" > ${RAINSENSORQTY_LASTRAIN}
|
timestart=$( date +%s)
|
||||||
|
if [[ $# -ne 0 ]] ; then
|
||||||
|
if [[ $# = 1 ]] ; then
|
||||||
|
howmany=$1
|
||||||
|
echo "one argument passed: rain event for $howmany loops"
|
||||||
|
(( time = timestart - howmany ))
|
||||||
|
elif [[ $# = 2 ]] ; then
|
||||||
|
howmany=$1
|
||||||
|
wait=$2
|
||||||
|
echo "two arguments passed: rain event for $howmany loops every $wait seconds"
|
||||||
|
(( time = timestart ))
|
||||||
|
else
|
||||||
|
echo "too many arguments... exit"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
howmany=$RAINSENSORQTY_LOOPSFORSETRAINING
|
||||||
|
(( time = timestart - $RAINSENSORQTY_LOOPSFORSETRAINING ))
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
echo "RAIN now! (for $howmany loops)"
|
||||||
|
for (( c=1; c<=$howmany; c++ ))
|
||||||
|
do
|
||||||
|
if (( wait > 0 )) ; then
|
||||||
|
time=$( date +%s)
|
||||||
|
else
|
||||||
|
(( time+= 1 ))
|
||||||
|
fi
|
||||||
|
linetoadd="$time:$c"
|
||||||
|
echo $linetoadd >> $RAINSENSORQTY_HISTORYRAW
|
||||||
|
sleep $wait
|
||||||
|
echo -e ".\c"
|
||||||
|
done
|
||||||
|
echo
|
||||||
|
|
||||||
|
if ! rain_history ; then # update rain history with last rain if not
|
||||||
|
echo "WARNING: rain_history function had error"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo $linetoadd > ${RAINSENSORQTY_LASTRAIN}
|
||||||
echo "file ${RAINSENSORQTY_LASTRAIN} updated."
|
echo "file ${RAINSENSORQTY_LASTRAIN} updated."
|
||||||
echo -e "\nLAST RAIN:"
|
|
||||||
cat $RAINSENSORQTY_LASTRAIN | rain_when_amount
|
echo "last 2 rain events:"
|
||||||
|
tail -2 $RAINSENSORQTY_HISTORY | rain_when_amount
|
||||||
|
|||||||
@@ -3,8 +3,8 @@
|
|||||||
# Author: androtto
|
# Author: androtto
|
||||||
# file "test_rainsensorqty_CHECK.sh"
|
# file "test_rainsensorqty_CHECK.sh"
|
||||||
# test script for checking rain status using drv_rainsensorqty_rain_sensor_get function
|
# test script for checking rain status using drv_rainsensorqty_rain_sensor_get function
|
||||||
# Version: 0.2.0a
|
# Version: 0.2.5
|
||||||
# Data: 13/Aug/2019
|
# Data: 07/Apr/2020
|
||||||
|
|
||||||
SCRIPTDIR="$(cd `dirname $0` ; pwd )"
|
SCRIPTDIR="$(cd `dirname $0` ; pwd )"
|
||||||
SCRIPTNAME=${0##*/}
|
SCRIPTNAME=${0##*/}
|
||||||
@@ -26,26 +26,19 @@ LOG_OUTPUT_DRV_FILE="$DIR_SCRIPT/log/$LOG_OUTPUT_DRV_FILE"
|
|||||||
# RAINSENSORQTY_LASTRAIN
|
# RAINSENSORQTY_LASTRAIN
|
||||||
# RAINSENSORQTY_HISTORY
|
# RAINSENSORQTY_HISTORY
|
||||||
|
|
||||||
rain_history # update rain history file if not
|
echo "RAIN HISTORY - last two events"
|
||||||
|
tail -2 $RAINSENSORQTY_HISTORY
|
||||||
echo "RAIN HISTORY - last five events"
|
tail -2 $RAINSENSORQTY_HISTORY | rain_when_amount
|
||||||
tail -5 $RAINSENSORQTY_HISTORY | rain_when_amount
|
|
||||||
|
|
||||||
echo -e "\nLAST RAIN"
|
|
||||||
cat $RAINSENSORQTY_LASTRAIN | rain_when_amount
|
|
||||||
|
|
||||||
#exit # for test
|
|
||||||
|
|
||||||
echo -e "\nbackup to .old files"
|
|
||||||
cp -p $RAINSENSORQTY_HISTORY ${RAINSENSORQTY_HISTORY}.old
|
|
||||||
cp -p $RAINSENSORQTY_LASTRAIN ${RAINSENSORQTY_LASTRAIN}.old
|
|
||||||
|
|
||||||
echo "...removing last event"
|
echo "...removing last event"
|
||||||
head -n-1 ${RAINSENSORQTY_HISTORY}.old > $RAINSENSORQTY_HISTORY
|
removelastrain
|
||||||
tail -1 $RAINSENSORQTY_HISTORY > $RAINSENSORQTY_LASTRAIN
|
echo "...rebuilding ${RAINSENSORQTY_HISTORY} from ${RAINSENSORQTY_HISTORYRAW}"
|
||||||
|
if ! rainevents > ${RAINSENSORQTY_HISTORY} ; then
|
||||||
|
echo "WARNING: rainevents function had error"
|
||||||
|
fi
|
||||||
|
tail -1 ${RAINSENSORQTY_HISTORYRAW} > ${RAINSENSORQTY_LASTRAIN}
|
||||||
|
|
||||||
echo -e "\nnew RAIN HISTORY - last five events"
|
echo -e "\nnew RAIN HISTORY - last two events"
|
||||||
tail -5 $RAINSENSORQTY_HISTORY | rain_when_amount
|
tail -2 $RAINSENSORQTY_HISTORY
|
||||||
|
tail -2 $RAINSENSORQTY_HISTORY | rain_when_amount
|
||||||
|
|
||||||
echo -e "\nnew LAST RAIN"
|
|
||||||
cat $RAINSENSORQTY_LASTRAIN | rain_when_amount
|
|
||||||
|
|||||||
@@ -3,14 +3,19 @@
|
|||||||
# Author: androtto
|
# Author: androtto
|
||||||
# file "common.include.sh"
|
# file "common.include.sh"
|
||||||
# common functions used by driver
|
# common functions used by driver
|
||||||
# Version: 0.2.0a
|
# Version: 0.2.5
|
||||||
# Data: 13/Aug/2019
|
# Data: 08/Jan/2020
|
||||||
|
|
||||||
|
|
||||||
#note:
|
#note:
|
||||||
#RAINSENSORQTY_MONPID="$TMPDIR/rainsensorqty_monitor.pid"
|
#RAINSENSORQTY_MONPID="$TMPDIR/rainsensorqty_monitor.pid"
|
||||||
#
|
#
|
||||||
|
|
||||||
|
sec2date()
|
||||||
|
{
|
||||||
|
date --date="@$1"
|
||||||
|
}
|
||||||
|
|
||||||
d() # short date & time
|
d() # short date & time
|
||||||
{
|
{
|
||||||
date '+%X-%x'
|
date '+%X-%x'
|
||||||
@@ -57,13 +62,28 @@ en_echo() # enhanched echo - check verbose variable
|
|||||||
|
|
||||||
rain_history()
|
rain_history()
|
||||||
{
|
{
|
||||||
|
[[ ! -f $RAINSENSORQTY_HISTORYRAW ]] && return 1
|
||||||
[[ ! -f $RAINSENSORQTY_HISTORY ]] && touch $RAINSENSORQTY_HISTORY
|
[[ ! -f $RAINSENSORQTY_HISTORY ]] && touch $RAINSENSORQTY_HISTORY
|
||||||
[[ ! -f $RAINSENSORQTY_LASTRAIN ]] && return 1
|
> $RAINSENSORQTY_HISTORYTMP
|
||||||
if grep -q ^$(<$RAINSENSORQTY_LASTRAIN)$ $RAINSENSORQTY_HISTORY ; then
|
|
||||||
: # do nothing
|
if lastrainevent=$( rainevents 1 ) ; then
|
||||||
return 2
|
: # done ok
|
||||||
else
|
else
|
||||||
cat $RAINSENSORQTY_LASTRAIN >> $RAINSENSORQTY_HISTORY
|
echo "WARNING: rainevents function had errors"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
#old #if grep -q ^$(<$RAINSENSORQTY_LASTRAIN)$ $RAINSENSORQTY_HISTORY ; then
|
||||||
|
if grep -q ^${lastrainevent}$ $RAINSENSORQTY_HISTORY ; then
|
||||||
|
: # already present
|
||||||
|
return 0
|
||||||
|
else
|
||||||
|
: # missing and fixed
|
||||||
|
if [[ $1 == tmp ]] ; then
|
||||||
|
echo $lastrainevent > $RAINSENSORQTY_HISTORYTMP
|
||||||
|
else
|
||||||
|
echo $lastrainevent >> $RAINSENSORQTY_HISTORY
|
||||||
|
fi
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@@ -71,12 +91,14 @@ rain_history()
|
|||||||
rain_when_amount()
|
rain_when_amount()
|
||||||
{
|
{
|
||||||
# from standard input
|
# from standard input
|
||||||
|
# format $time:$endtime:$endsequence
|
||||||
cat - | while read line
|
cat - | while read line
|
||||||
do
|
do
|
||||||
set -- ${line//:/ }
|
set -- ${line//:/ }
|
||||||
when=$1
|
start=$1
|
||||||
howmuch=$2
|
stop=$2
|
||||||
printf "RAINED on %s for %.2f mm\n" "$(date --date="@$1")" $( $JQ -n "$howmuch * $RAINSENSORQTY_MMEACH" )
|
howmuch=$3
|
||||||
|
printf "RAINED for %7.2f mm between %s and %s\n" $( $JQ -n "$howmuch * $RAINSENSORQTY_MMEACH" ) "$(date --date="@$start")" "$(date --date="@$stop")"
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -88,3 +110,54 @@ check_TMPDIR()
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rainevents()
|
||||||
|
{
|
||||||
|
if [[ ! -f $RAINSENSORQTY_HISTORYRAW ]] ; then
|
||||||
|
#echo "WARNING: no \$RAINSENSORQTY_HISTORYRAW file"# cannot echo, redirected output
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
case $1 in
|
||||||
|
[0-9]|[0-9][0-9]) howmanyevent=$1 ;;
|
||||||
|
# -1) skiplast=true ;;
|
||||||
|
*) howmanyevent=-1 ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
newloop=yes
|
||||||
|
tac $RAINSENSORQTY_HISTORYRAW | while read line
|
||||||
|
do
|
||||||
|
set -- ${line//:/ }
|
||||||
|
time=$1
|
||||||
|
sequence=$2
|
||||||
|
if [[ $newloop == yes ]] ; then
|
||||||
|
endtime=$time
|
||||||
|
endsequence=$sequence
|
||||||
|
newloop=no
|
||||||
|
fi
|
||||||
|
if (( sequence == 1 )) ; then
|
||||||
|
# [[ $skiplast=true ]] && { skilast=false ; continue ; }
|
||||||
|
echo $time:$endtime:$endsequence
|
||||||
|
newloop=yes
|
||||||
|
(( event +=1 ))
|
||||||
|
fi
|
||||||
|
(( howmanyevent == event )) && break
|
||||||
|
done | sort -k1n
|
||||||
|
}
|
||||||
|
|
||||||
|
removelastrain()
|
||||||
|
{
|
||||||
|
if [[ ! -f $RAINSENSORQTY_HISTORYRAW ]] ; then
|
||||||
|
echo "WARNING: no \$RAINSENSORQTY_HISTORYRAW file"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
next=false
|
||||||
|
tac $RAINSENSORQTY_HISTORYRAW | while read line
|
||||||
|
do
|
||||||
|
set -- ${line//:/ }
|
||||||
|
time=$1
|
||||||
|
sequence=$2
|
||||||
|
[[ $next = true ]] && echo $line
|
||||||
|
(( sequence == 1 )) && next=true
|
||||||
|
done | tac > ${RAINSENSORQTY_HISTORYRAW}_$$
|
||||||
|
mv ${RAINSENSORQTY_HISTORYRAW}_$$ $RAINSENSORQTY_HISTORYRAW
|
||||||
|
}
|
||||||
|
|||||||
66
drv/rainsensorqty/conf_example/config.include.sh
Normal file
66
drv/rainsensorqty/conf_example/config.include.sh
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
#
|
||||||
|
# Driver rainsensorqty - driver for measure the rain volume
|
||||||
|
# Author: androtto
|
||||||
|
# file "config.include.sh"
|
||||||
|
# specific driver config file
|
||||||
|
# Version: 0.2.5
|
||||||
|
# Data: 08/Jan/2020
|
||||||
|
|
||||||
|
export TMPDIR=/tmp
|
||||||
|
|
||||||
|
RAINSENSOR_DEBOUNCE=0.3 # 0.3 seconds for manage debounce of reed contact
|
||||||
|
|
||||||
|
RAINSENSORQTY_verbose="yes" # yes/no
|
||||||
|
|
||||||
|
RAINSENSORQTY_LASTRAIN="$STATUS_DIR/rainsensorqty_lastrain"
|
||||||
|
RAINSENSORQTY_HISTORY="$STATUS_DIR/rainsensorqty_history"
|
||||||
|
RAINSENSORQTY_HISTORYRAW="$STATUS_DIR/rainsensorqty_history.raw"
|
||||||
|
RAINSENSORQTY_HISTORYTMP="$TMPDIR/rainsensorqty_history.tmp"
|
||||||
|
|
||||||
|
RAINSENSORQTY_MONITORLOG="$DIR_SCRIPT/log/rainsensorqty_monitor.log"
|
||||||
|
|
||||||
|
RAINSENSORQTY_MONPID="$TMPDIR/rainsensorqty_monitor.pid"
|
||||||
|
RAINSENSORQTY_STATE="$TMPDIR/rainsensorqty_state"
|
||||||
|
RAINSENSORQTY_STATE_HIST="$TMPDIR/rainsensorqty_state.history"
|
||||||
|
|
||||||
|
RAINSENSORQTY_DIR="$DIR_SCRIPT/drv/rainsensorqty"
|
||||||
|
|
||||||
|
monitor_sh="$RAINSENSORQTY_DIR/drv_rainsensorqty_monitor.sh"
|
||||||
|
|
||||||
|
# internal gpio resistor, 3 values: pull-up, pull-down, none
|
||||||
|
# pull-up/down if rain gauge is connected directly to raspberry
|
||||||
|
# none if connected through an optocoupler circuit
|
||||||
|
GPIO_RESISTOR="pull-up" #pull-up|pull-down|none
|
||||||
|
|
||||||
|
#rising means waiting for 1 status (from 0)
|
||||||
|
#falling means waiting for 0 status (from 1)
|
||||||
|
#RAINSENSORQTY_PULSE=rising # pull-down circuit (rest status is 0)
|
||||||
|
#RAINSENSORQTY_PULSE=falling # pull-up circuit (rest status is 1)
|
||||||
|
(( RAIN_GPIO_STATE == 1 )) && RAINSENSORQTY_PULSE=rising # pull-down circuit (rest status is 0)
|
||||||
|
(( RAIN_GPIO_STATE == 0 )) && RAINSENSORQTY_PULSE=falling # pull-up circuit (rest status is 1)
|
||||||
|
|
||||||
|
|
||||||
|
config_check()
|
||||||
|
{
|
||||||
|
var2check="RAINSENSOR_DEBOUNCE RAINSENSORQTY_verbose RAINSENSORQTY_LASTRAIN RAINSENSORQTY_HISTORY RAINSENSORQTY_MONITORLOG RAINSENSORQTY_MONPID RAINSENSORQTY_DIR monitor_sh"
|
||||||
|
for var in $var2check
|
||||||
|
do
|
||||||
|
#${!a}
|
||||||
|
if [[ -z ${!var} ]] ; then
|
||||||
|
echo "ERROR: \$$var not set"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
if [[ -z $RAINSENSORQTY_PULSE ]] ; then
|
||||||
|
echo "ERROR: RAIN_GPIO_STATE not set in piGarden.conf"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
return 0
|
||||||
|
case $GPIO_RESISTOR in
|
||||||
|
pull-up|pull-down|none) return 0 ;;
|
||||||
|
*) echo "ERROR: GPIO_RESISTOR not set correctly - values are \"pull-up|pull-down|none\" "
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
@@ -3,8 +3,8 @@
|
|||||||
# Author: androtto
|
# Author: androtto
|
||||||
# file "config.include.sh"
|
# file "config.include.sh"
|
||||||
# specific driver config file
|
# specific driver config file
|
||||||
# Version: 0.2.0
|
# Version: 0.2.5
|
||||||
# Data: 11/Aug/2019
|
# Data: 08/Jan/2020
|
||||||
|
|
||||||
export TMPDIR=/tmp
|
export TMPDIR=/tmp
|
||||||
|
|
||||||
@@ -14,6 +14,8 @@ RAINSENSORQTY_verbose="yes" # yes/no
|
|||||||
|
|
||||||
RAINSENSORQTY_LASTRAIN="$STATUS_DIR/rainsensorqty_lastrain"
|
RAINSENSORQTY_LASTRAIN="$STATUS_DIR/rainsensorqty_lastrain"
|
||||||
RAINSENSORQTY_HISTORY="$STATUS_DIR/rainsensorqty_history"
|
RAINSENSORQTY_HISTORY="$STATUS_DIR/rainsensorqty_history"
|
||||||
|
RAINSENSORQTY_HISTORYRAW="$STATUS_DIR/rainsensorqty_history.raw"
|
||||||
|
RAINSENSORQTY_HISTORYTMP="$TMPDIR/rainsensorqty_history.tmp"
|
||||||
|
|
||||||
RAINSENSORQTY_MONITORLOG="$DIR_SCRIPT/log/rainsensorqty_monitor.log"
|
RAINSENSORQTY_MONITORLOG="$DIR_SCRIPT/log/rainsensorqty_monitor.log"
|
||||||
|
|
||||||
|
|||||||
@@ -4,8 +4,8 @@
|
|||||||
# Author: androtto
|
# Author: androtto
|
||||||
# file "drv_rainsensorqty_monitor.sh"
|
# file "drv_rainsensorqty_monitor.sh"
|
||||||
# monitor script
|
# monitor script
|
||||||
# Version: 0.2.2
|
# Version: 0.2.5b
|
||||||
# Data: 08/Sep/2019
|
# Data: 12/May/2020
|
||||||
|
|
||||||
resetcounter()
|
resetcounter()
|
||||||
{
|
{
|
||||||
@@ -58,13 +58,13 @@ rain_history
|
|||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
en_echo "---- NEW RUN ----"
|
en_echo "---- NEW RUN ----"
|
||||||
|
en_echo "WAITING FOR $RAINSENSORQTY_PULSE PULSE"
|
||||||
|
|
||||||
# loop forever
|
# loop forever
|
||||||
while true
|
while true
|
||||||
do
|
do
|
||||||
before=`date +%s`
|
before=`date +%s`
|
||||||
sleep $RAINSENSOR_DEBOUNCE
|
sleep $RAINSENSOR_DEBOUNCE
|
||||||
en_echo "WAITING FOR $RAINSENSORQTY_PULSE PULSE"
|
|
||||||
$GPIO -g wfi $gpio_port $RAINSENSORQTY_PULSE
|
$GPIO -g wfi $gpio_port $RAINSENSORQTY_PULSE
|
||||||
now=`date +%s`
|
now=`date +%s`
|
||||||
(( elapsed = now - before ))
|
(( elapsed = now - before ))
|
||||||
@@ -75,10 +75,9 @@ do
|
|||||||
rain_history &
|
rain_history &
|
||||||
fi
|
fi
|
||||||
(( counter+=1 ))
|
(( counter+=1 ))
|
||||||
en_echo "$RAINSENSORQTY_PULSE PULSE #$counter RECEIVED"
|
echo "$now:$counter" >> ${RAINSENSORQTY_HISTORYRAW} &
|
||||||
echo "$now:$counter" > ${RAINSENSORQTY_STATE} &
|
|
||||||
echo "$now:$counter" >> ${RAINSENSORQTY_STATE_HIST} &
|
|
||||||
MMWATER=$( $JQ -n "$counter*$MMEACH" )
|
MMWATER=$( $JQ -n "$counter*$MMEACH" )
|
||||||
|
en_echo $( printf "%s PULSE #%d RECEIVED (%.2f mm)" $RAINSENSORQTY_PULSE $counter $MMWATER )
|
||||||
text=$(printf "%.2f mm height (#%d pulse)" $MMWATER $counter )
|
text=$(printf "%.2f mm height (#%d pulse)" $MMWATER $counter )
|
||||||
if (( counter >= RAINSENSORQTY_LOOPSFORSETRAINING )) ; then
|
if (( counter >= RAINSENSORQTY_LOOPSFORSETRAINING )) ; then
|
||||||
drv_rainsensorqty_writelog $f "RAINING - $text" &
|
drv_rainsensorqty_writelog $f "RAINING - $text" &
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ function drv_remote_rele_open {
|
|||||||
error="${error%\"}"
|
error="${error%\"}"
|
||||||
error="${error#\"}"
|
error="${error#\"}"
|
||||||
echo "error=$error"
|
echo "error=$error"
|
||||||
log_write "Remote rele open error: $error"
|
log_write "drv_remote" "error" "Remote rele open error: $error"
|
||||||
message_write "warning" "Remote rele open error: $error"
|
message_write "warning" "Remote rele open error: $error"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
@@ -68,7 +68,7 @@ function drv_remote_rele_close {
|
|||||||
error="${error%\"}"
|
error="${error%\"}"
|
||||||
error="${error#\"}"
|
error="${error#\"}"
|
||||||
echo "error=$error"
|
echo "error=$error"
|
||||||
log_write "Remote rele close error: $error"
|
log_write "drv_remoter" "error" "Remote rele close error: $error"
|
||||||
message_write "warning" "Remote rele close error: $error"
|
message_write "warning" "Remote rele close error: $error"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ function drv_sonoff_tasmota_http_rele_open {
|
|||||||
error="${error%\"}"
|
error="${error%\"}"
|
||||||
error="${error#\"}"
|
error="${error#\"}"
|
||||||
echo "error=$error"
|
echo "error=$error"
|
||||||
log_write "Remote rele open error: $error"
|
log_write "drv_sonoff_tasmota_http" "error" "Remote rele open error: $error"
|
||||||
message_write "warning" "Remote rele open error: $error"
|
message_write "warning" "Remote rele open error: $error"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
@@ -69,7 +69,7 @@ function drv_sonoff_tasmota_http_rele_close {
|
|||||||
error="${error%\"}"
|
error="${error%\"}"
|
||||||
error="${error#\"}"
|
error="${error#\"}"
|
||||||
echo "error=$error"
|
echo "error=$error"
|
||||||
log_write "Remote rele close error: $error"
|
log_write "drv_sonoff_tasmota_http" "error" "Remote rele close error: $error"
|
||||||
message_write "warning" "Remote rele close error: $error"
|
message_write "warning" "Remote rele close error: $error"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ function drv_spb16ch_boards_id_load {
|
|||||||
SPB16CH_USED_ID+=("$board_id")
|
SPB16CH_USED_ID+=("$board_id")
|
||||||
done
|
done
|
||||||
else
|
else
|
||||||
log_write "spb16ch: file $SPB16CH_BOARD_ID_STORE_FILE not found: remember to run 'piGarden init' to generate the file"
|
log_write "drv_spb16ch" "error" "spb16ch: file $SPB16CH_BOARD_ID_STORE_FILE not found: remember to run 'piGarden init' to generate the file"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ function drv_spb16ch_rele_open {
|
|||||||
local rele_data=${SPB16CH_RELE_MAP[$rele_id]}
|
local rele_data=${SPB16CH_RELE_MAP[$rele_id]}
|
||||||
if [[ -z $rele_data ]]; then
|
if [[ -z $rele_data ]]; then
|
||||||
local message="Error - Rele map not defined - rele_id=$rele_id - ($1)"
|
local message="Error - Rele map not defined - rele_id=$rele_id - ($1)"
|
||||||
log_write "$message"
|
log_write "drv_spb16ch" "error" "$message"
|
||||||
message_write "warning" "$message"
|
message_write "warning" "$message"
|
||||||
fi
|
fi
|
||||||
local address_num=${rele_data:0:2}
|
local address_num=${rele_data:0:2}
|
||||||
@@ -52,7 +52,7 @@ function drv_spb16ch_rele_close {
|
|||||||
local rele_data=${SPB16CH_RELE_MAP[$rele_id]}
|
local rele_data=${SPB16CH_RELE_MAP[$rele_id]}
|
||||||
if [[ -z $rele_data ]]; then
|
if [[ -z $rele_data ]]; then
|
||||||
local message="Error - Rele map not defined - rele_id=$rele_id - ($1)"
|
local message="Error - Rele map not defined - rele_id=$rele_id - ($1)"
|
||||||
log_write "$message"
|
log_write "drv_spb16ch" "error" "$message"
|
||||||
message_write "warning" "$message"
|
message_write "warning" "$message"
|
||||||
fi
|
fi
|
||||||
local address_num=${rele_data:0:2}
|
local address_num=${rele_data:0:2}
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ function cron_del {
|
|||||||
|
|
||||||
if [ -z "$CRON_TYPE" ]; then
|
if [ -z "$CRON_TYPE" ]; then
|
||||||
echo "Cron type is empty" >&2
|
echo "Cron type is empty" >&2
|
||||||
log_write "Cron type is empty"
|
log_write "cron" "error" "Cron type is empty"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -25,17 +25,17 @@ function cron_del {
|
|||||||
fi
|
fi
|
||||||
if ! [[ $START =~ $re ]] ; then
|
if ! [[ $START =~ $re ]] ; then
|
||||||
echo "Cron start don't find" >&2
|
echo "Cron start don't find" >&2
|
||||||
log_write "Cron start don't find"
|
log_write "cron" "error" "Cron start don't find"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
if ! [[ $END =~ $re ]] ; then
|
if ! [[ $END =~ $re ]] ; then
|
||||||
echo "Cron end cron don't find" >&2
|
echo "Cron end cron don't find" >&2
|
||||||
log_write "Cron end cron don't find"
|
log_write "cron" "error" "Cron end cron don't find"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
if [ "$START" -gt "$END" ]; then
|
if [ "$START" -gt "$END" ]; then
|
||||||
echo "Wrong position for start and end in cron" >&2
|
echo "Wrong position for start and end in cron" >&2
|
||||||
log_write "Wrong position for start and end in cron"
|
log_write "cron" "error" "Wrong position for start and end in cron"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -74,7 +74,7 @@ function cron_add {
|
|||||||
|
|
||||||
if [ -z "$CRON_TYPE" ]; then
|
if [ -z "$CRON_TYPE" ]; then
|
||||||
echo "Cron type is empty" >&2
|
echo "Cron type is empty" >&2
|
||||||
log_write "Cron type is empty"
|
log_write "cron" "error" "Cron type is empty"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -91,12 +91,12 @@ function cron_add {
|
|||||||
else
|
else
|
||||||
if ! [[ $START =~ $re ]] ; then
|
if ! [[ $START =~ $re ]] ; then
|
||||||
echo "Cron start don't find" >&2
|
echo "Cron start don't find" >&2
|
||||||
log_write "Cron start don't find"
|
log_write "cron" "error" "Cron start don't find"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
if ! [[ $END =~ $re ]] ; then
|
if ! [[ $END =~ $re ]] ; then
|
||||||
echo "Cron end cron don't find" >&2
|
echo "Cron end cron don't find" >&2
|
||||||
log_write "Cron end cron don't find"
|
log_write "cron" "error" "Cron end cron don't find"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
START=$(($START + 1))
|
START=$(($START + 1))
|
||||||
@@ -104,7 +104,7 @@ function cron_add {
|
|||||||
|
|
||||||
if [ "$START" -gt "$END" ]; then
|
if [ "$START" -gt "$END" ]; then
|
||||||
echo "Wrong position for start and end in cron" >&2
|
echo "Wrong position for start and end in cron" >&2
|
||||||
log_write "Wrong position for start and end in cron"
|
log_write "cron" "error" "Wrong position for start and end in cron"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -183,7 +183,7 @@ function cron_add {
|
|||||||
|
|
||||||
*)
|
*)
|
||||||
echo "Wrong cron type: $CRON_TYPE"
|
echo "Wrong cron type: $CRON_TYPE"
|
||||||
log_write "Wrong cron type: $CRON_TYPE"
|
log_write "cron" "error" "Wrong cron type: $CRON_TYPE"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
esac
|
esac
|
||||||
@@ -225,7 +225,7 @@ function cron_get {
|
|||||||
|
|
||||||
if [ -z "$CRON_TYPE" ]; then
|
if [ -z "$CRON_TYPE" ]; then
|
||||||
echo "Cron type is empty" >&2
|
echo "Cron type is empty" >&2
|
||||||
log_write "Cron type is empty"
|
log_write "cron" "error" "Cron type is empty"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -241,12 +241,12 @@ function cron_get {
|
|||||||
else
|
else
|
||||||
if ! [[ $START =~ $re ]] ; then
|
if ! [[ $START =~ $re ]] ; then
|
||||||
echo "Cron start don't find" >&2
|
echo "Cron start don't find" >&2
|
||||||
log_write "Cron start don't find"
|
log_write "cron" "error" "Cron start don't find"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
if ! [[ $END =~ $re ]] ; then
|
if ! [[ $END =~ $re ]] ; then
|
||||||
echo "Cron end cron don't find" >&2
|
echo "Cron end cron don't find" >&2
|
||||||
log_write "Cron end cron don't find"
|
log_write "cron" "error" "Cron end cron don't find"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
START=$(($START + 1))
|
START=$(($START + 1))
|
||||||
@@ -254,7 +254,7 @@ function cron_get {
|
|||||||
|
|
||||||
if [ "$START" -gt "$END" ]; then
|
if [ "$START" -gt "$END" ]; then
|
||||||
echo "Wrong position for start and end in cron" >&2
|
echo "Wrong position for start and end in cron" >&2
|
||||||
log_write "Wrong position for start and end in cron"
|
log_write "cron" "error" "Wrong position for start and end in cron"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -370,7 +370,7 @@ function add_cron_open {
|
|||||||
|
|
||||||
local exists=`alias_exists $1`
|
local exists=`alias_exists $1`
|
||||||
if [ "check $exists" = "check FALSE" ]; then
|
if [ "check $exists" = "check FALSE" ]; then
|
||||||
log_write "Alias $1 not found"
|
log_write "cron" "error" "Alias $1 not found"
|
||||||
echo "Alias $1 not found"
|
echo "Alias $1 not found"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
@@ -387,7 +387,7 @@ function del_cron_open {
|
|||||||
|
|
||||||
local exists=`alias_exists $1`
|
local exists=`alias_exists $1`
|
||||||
if [ "check $exists" = "check FALSE" ]; then
|
if [ "check $exists" = "check FALSE" ]; then
|
||||||
log_write "Alias $1 not found"
|
log_write "cron" "error" "Alias $1 not found"
|
||||||
echo "Alias $1 not found"
|
echo "Alias $1 not found"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
@@ -404,7 +404,7 @@ function get_cron_open {
|
|||||||
|
|
||||||
local exists=`alias_exists $1`
|
local exists=`alias_exists $1`
|
||||||
if [ "check $exists" = "check FALSE" ]; then
|
if [ "check $exists" = "check FALSE" ]; then
|
||||||
log_write "Alias $1 not found"
|
log_write "cron" "error" "Alias $1 not found"
|
||||||
echo "Alias $1 not found"
|
echo "Alias $1 not found"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
@@ -421,7 +421,7 @@ function del_cron_open_in {
|
|||||||
|
|
||||||
local exists=`alias_exists $1`
|
local exists=`alias_exists $1`
|
||||||
if [ "check $exists" = "check FALSE" ]; then
|
if [ "check $exists" = "check FALSE" ]; then
|
||||||
log_write "Alias $1 not found"
|
log_write "cron" "error" "Alias $1 not found"
|
||||||
echo "Alias $1 not found"
|
echo "Alias $1 not found"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
@@ -439,7 +439,7 @@ function get_cron_close {
|
|||||||
|
|
||||||
local exists=`alias_exists $1`
|
local exists=`alias_exists $1`
|
||||||
if [ "check $exists" = "check FALSE" ]; then
|
if [ "check $exists" = "check FALSE" ]; then
|
||||||
log_write "Alias $1 not found"
|
log_write "cron" "error" "Alias $1 not found"
|
||||||
echo "Alias $1 not found"
|
echo "Alias $1 not found"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
@@ -462,7 +462,7 @@ function add_cron_close {
|
|||||||
|
|
||||||
local exists=`alias_exists $1`
|
local exists=`alias_exists $1`
|
||||||
if [ "check $exists" = "check FALSE" ]; then
|
if [ "check $exists" = "check FALSE" ]; then
|
||||||
log_write "Alias $1 not found"
|
log_write "cron" "error" "Alias $1 not found"
|
||||||
echo "Alias $1 not found"
|
echo "Alias $1 not found"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
@@ -479,7 +479,7 @@ function del_cron_close {
|
|||||||
|
|
||||||
local exists=`alias_exists $1`
|
local exists=`alias_exists $1`
|
||||||
if [ "check $exists" = "check FALSE" ]; then
|
if [ "check $exists" = "check FALSE" ]; then
|
||||||
log_write "Alias $1 not found"
|
log_write "cron" "error" "Alias $1 not found"
|
||||||
echo "Alias $1 not found"
|
echo "Alias $1 not found"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
@@ -559,7 +559,79 @@ function cron_disable_all_open_close {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
done
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# Attiva tutte le schedulazioni di apertura e chiusura elettrovalvole
|
||||||
|
#
|
||||||
|
function cron_enable_all_open_close {
|
||||||
|
|
||||||
|
local a=""
|
||||||
|
local al=""
|
||||||
|
local cron=""
|
||||||
|
|
||||||
|
#
|
||||||
|
# Disabilita tutte le schedulazioni di apertura
|
||||||
|
#
|
||||||
|
for i in $(seq $EV_TOTAL)
|
||||||
|
do
|
||||||
|
a=EV"$i"_ALIAS
|
||||||
|
al=${!a}
|
||||||
|
local crons=`get_cron_open $al`
|
||||||
|
if [[ ! -z "$crons" ]]; then
|
||||||
|
del_cron_open $al
|
||||||
|
IFS=$'\n' # make newlines the only separator
|
||||||
|
for cron in $crons
|
||||||
|
do
|
||||||
|
#echo "-- $cron --"
|
||||||
|
CRON_M=`echo $cron | $CUT -d' ' -f1,1`
|
||||||
|
CRON_H=`echo $cron | $CUT -d' ' -f2,2`
|
||||||
|
CRON_DOM=`echo $cron | $CUT -d' ' -f3,3`
|
||||||
|
CRON_MON=`echo $cron | $CUT -d' ' -f4,4`
|
||||||
|
CRON_DOW=`echo $cron | $CUT -d' ' -f5,5`
|
||||||
|
|
||||||
|
if [[ ${CRON_M:0:1} == "#" ]]; then
|
||||||
|
CRON_M=${CRON_M:1:${#CRON_M}}
|
||||||
|
fi
|
||||||
|
#echo "++ $CRON_M $CRON_H $CRON_DOM $CRON_MON $CRON_DOW ++"
|
||||||
|
|
||||||
|
add_cron_open $al "$CRON_M" "$CRON_H" "$CRON_DOM" "$CRON_MON" "$CRON_DOW"
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
done
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# Disabilita tutte le schedulazioni di chiusura
|
||||||
|
#
|
||||||
|
for i in $(seq $EV_TOTAL)
|
||||||
|
do
|
||||||
|
a=EV"$i"_ALIAS
|
||||||
|
al=${!a}
|
||||||
|
local crons=`get_cron_close $al`
|
||||||
|
if [[ ! -z "$crons" ]]; then
|
||||||
|
del_cron_close $al
|
||||||
|
IFS=$'\n' # make newlines the only separator
|
||||||
|
for cron in $crons
|
||||||
|
do
|
||||||
|
#echo "-- $cron --"
|
||||||
|
CRON_M=`echo $cron | $CUT -d' ' -f1,1`
|
||||||
|
CRON_H=`echo $cron | $CUT -d' ' -f2,2`
|
||||||
|
CRON_DOM=`echo $cron | $CUT -d' ' -f3,3`
|
||||||
|
CRON_MON=`echo $cron | $CUT -d' ' -f4,4`
|
||||||
|
CRON_DOW=`echo $cron | $CUT -d' ' -f5,5`
|
||||||
|
|
||||||
|
if [[ ${CRON_M:0:1} == "#" ]]; then
|
||||||
|
CRON_M=${CRON_M:1:${#CRON_M}}
|
||||||
|
fi
|
||||||
|
#echo "++ $CRON_M $CRON_H $CRON_DOM $CRON_MON $CRON_DOW ++"
|
||||||
|
|
||||||
|
add_cron_close $al "$CRON_M" "$CRON_H" "$CRON_DOM" "$CRON_MON" "$CRON_DOW"
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
done
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ function drv_rele_init {
|
|||||||
$GPIO -g mode $idx out # setta il gpio nella modalita di scrittura
|
$GPIO -g mode $idx out # setta il gpio nella modalita di scrittura
|
||||||
# Il driver definito non è stato trovato
|
# Il driver definito non è stato trovato
|
||||||
elif [ "$fnc" == "drvnotfound" ]; then
|
elif [ "$fnc" == "drvnotfound" ]; then
|
||||||
log_write "Driver not found: $idx"
|
log_write "drv" "error" "Driver not found: $idx"
|
||||||
message_write "warning" "Driver not found: $idx"
|
message_write "warning" "Driver not found: $idx"
|
||||||
else
|
else
|
||||||
echo "$(date) $fnc arg:$idx" >> "$LOG_OUTPUT_DRV_FILE"
|
echo "$(date) $fnc arg:$idx" >> "$LOG_OUTPUT_DRV_FILE"
|
||||||
@@ -116,7 +116,7 @@ function drv_rele_close {
|
|||||||
$GPIO -g write $idx $RELE_GPIO_CLOSE
|
$GPIO -g write $idx $RELE_GPIO_CLOSE
|
||||||
# Il driver definito non è stato trovato
|
# Il driver definito non è stato trovato
|
||||||
elif [ "$fnc" == "drvnotfound" ]; then
|
elif [ "$fnc" == "drvnotfound" ]; then
|
||||||
log_write "Driver not found: $idx"
|
log_write "drv" "error" "Driver not found: $idx"
|
||||||
message_write "warning" "Driver not found: $idx"
|
message_write "warning" "Driver not found: $idx"
|
||||||
return 1
|
return 1
|
||||||
else
|
else
|
||||||
@@ -142,7 +142,7 @@ function drv_rele_open {
|
|||||||
$GPIO -g write $idx $RELE_GPIO_OPEN
|
$GPIO -g write $idx $RELE_GPIO_OPEN
|
||||||
# Il driver definito non è stato trovato
|
# Il driver definito non è stato trovato
|
||||||
elif [ "$fnc" == "drvnotfound" ]; then
|
elif [ "$fnc" == "drvnotfound" ]; then
|
||||||
log_write "Driver not found: $idx"
|
log_write "drv" "error" "Driver not found: $idx"
|
||||||
message_write "warning" "Driver not found: $idx"
|
message_write "warning" "Driver not found: $idx"
|
||||||
return 1
|
return 1
|
||||||
else
|
else
|
||||||
@@ -172,7 +172,7 @@ function drv_supply_bistable_init {
|
|||||||
$GPIO -g mode $idx1 out
|
$GPIO -g mode $idx1 out
|
||||||
# Il driver definito non è stato trovato
|
# Il driver definito non è stato trovato
|
||||||
elif [ "$fnc1" == "drvnotfound" ]; then
|
elif [ "$fnc1" == "drvnotfound" ]; then
|
||||||
log_write "Driver not found: $idx1"
|
log_write "drv" "error" "Driver not found: $idx1"
|
||||||
message_write "warning" "Driver not found: $idx1"
|
message_write "warning" "Driver not found: $idx1"
|
||||||
return
|
return
|
||||||
else
|
else
|
||||||
@@ -186,7 +186,7 @@ function drv_supply_bistable_init {
|
|||||||
$GPIO -g mode $idx2 out
|
$GPIO -g mode $idx2 out
|
||||||
# Il driver definito non è stato trovato
|
# Il driver definito non è stato trovato
|
||||||
elif [ "$fnc2" == "drvnotfound" ]; then
|
elif [ "$fnc2" == "drvnotfound" ]; then
|
||||||
log_write "Driver not found: $idx2"
|
log_write "drv" "error" "Driver not found: $idx2"
|
||||||
message_write "warning" "Driver not found: $idx2"
|
message_write "warning" "Driver not found: $idx2"
|
||||||
else
|
else
|
||||||
echo "$(date) $fnc2 arg:$idx2" >> "$LOG_OUTPUT_DRV_FILE"
|
echo "$(date) $fnc2 arg:$idx2" >> "$LOG_OUTPUT_DRV_FILE"
|
||||||
@@ -212,7 +212,7 @@ function drv_supply_positive {
|
|||||||
$GPIO -g write $idx1 $SUPPLY_GPIO_POS
|
$GPIO -g write $idx1 $SUPPLY_GPIO_POS
|
||||||
# Il driver definito non è stato trovato
|
# Il driver definito non è stato trovato
|
||||||
elif [ "$fnc1" == "drvnotfound" ]; then
|
elif [ "$fnc1" == "drvnotfound" ]; then
|
||||||
log_write "Driver not found: $idx1"
|
log_write "drv" "error" "Driver not found: $idx1"
|
||||||
message_write "warning" "Driver not found: $idx1"
|
message_write "warning" "Driver not found: $idx1"
|
||||||
return
|
return
|
||||||
else
|
else
|
||||||
@@ -225,7 +225,7 @@ function drv_supply_positive {
|
|||||||
$GPIO -g write $idx2 $SUPPLY_GPIO_POS
|
$GPIO -g write $idx2 $SUPPLY_GPIO_POS
|
||||||
# Il driver definito non è stato trovato
|
# Il driver definito non è stato trovato
|
||||||
elif [ "$fnc2" == "drvnotfound" ]; then
|
elif [ "$fnc2" == "drvnotfound" ]; then
|
||||||
log_write "Driver not found: $idx2"
|
log_write "drv" "error" "Driver not found: $idx2"
|
||||||
message_write "warning" "Driver not found: $idx2"
|
message_write "warning" "Driver not found: $idx2"
|
||||||
else
|
else
|
||||||
echo "$(date) $fnc2 arg:$idx2" >> "$LOG_OUTPUT_DRV_FILE"
|
echo "$(date) $fnc2 arg:$idx2" >> "$LOG_OUTPUT_DRV_FILE"
|
||||||
@@ -251,7 +251,7 @@ function drv_supply_negative {
|
|||||||
$GPIO -g write $idx1 $SUPPLY_GPIO_NEG
|
$GPIO -g write $idx1 $SUPPLY_GPIO_NEG
|
||||||
# Il driver definito non è stato trovato
|
# Il driver definito non è stato trovato
|
||||||
elif [ "$fnc1" == "drvnotfound" ]; then
|
elif [ "$fnc1" == "drvnotfound" ]; then
|
||||||
log_write "Driver not found: $idx1"
|
log_write "drv" "error" "Driver not found: $idx1"
|
||||||
message_write "warning" "Driver not found: $idx1"
|
message_write "warning" "Driver not found: $idx1"
|
||||||
return
|
return
|
||||||
else
|
else
|
||||||
@@ -264,7 +264,7 @@ function drv_supply_negative {
|
|||||||
$GPIO -g write $idx2 $SUPPLY_GPIO_NEG
|
$GPIO -g write $idx2 $SUPPLY_GPIO_NEG
|
||||||
# Il driver definito non è stato trovato
|
# Il driver definito non è stato trovato
|
||||||
elif [ "$fnc2" == "drvnotfound" ]; then
|
elif [ "$fnc2" == "drvnotfound" ]; then
|
||||||
log_write "Driver not found: $idx2"
|
log_write "drv" "error" "Driver not found: $idx2"
|
||||||
message_write "warning" "Driver not found: $idx2"
|
message_write "warning" "Driver not found: $idx2"
|
||||||
else
|
else
|
||||||
echo "$(date) $fnc2 arg:$idx2" >> "$LOG_OUTPUT_DRV_FILE"
|
echo "$(date) $fnc2 arg:$idx2" >> "$LOG_OUTPUT_DRV_FILE"
|
||||||
@@ -288,7 +288,7 @@ function drv_rain_sensor_init {
|
|||||||
$GPIO -g mode $idx in
|
$GPIO -g mode $idx in
|
||||||
# Il driver definito non è stato trovato
|
# Il driver definito non è stato trovato
|
||||||
elif [ "$fnc" == "drvnotfound" ]; then
|
elif [ "$fnc" == "drvnotfound" ]; then
|
||||||
log_write "Driver not found: $idx"
|
log_write "drv" "error" "Driver not found: $idx"
|
||||||
message_write "warning" "Driver not found: $idx"
|
message_write "warning" "Driver not found: $idx"
|
||||||
else
|
else
|
||||||
echo "$(date) $fnc arg:$idx" >> "$LOG_OUTPUT_DRV_FILE"
|
echo "$(date) $fnc arg:$idx" >> "$LOG_OUTPUT_DRV_FILE"
|
||||||
@@ -312,7 +312,7 @@ function drv_rain_sensor_get {
|
|||||||
vret=`$GPIO -g read $idx`
|
vret=`$GPIO -g read $idx`
|
||||||
# Il driver definito non è stato trovato
|
# Il driver definito non è stato trovato
|
||||||
elif [ "$fnc" == "drvnotfound" ]; then
|
elif [ "$fnc" == "drvnotfound" ]; then
|
||||||
log_write "Driver not found: $idx"
|
log_write "drv" "error" "Driver not found: $idx"
|
||||||
message_write "warning" "Driver not found: $idx"
|
message_write "warning" "Driver not found: $idx"
|
||||||
else
|
else
|
||||||
echo "$(date) $fnc arg:$idx" >> "$LOG_OUTPUT_DRV_FILE"
|
echo "$(date) $fnc arg:$idx" >> "$LOG_OUTPUT_DRV_FILE"
|
||||||
@@ -335,11 +335,11 @@ function drv_rain_online_get {
|
|||||||
|
|
||||||
# Nessun driver definito, esegue la lettura del sensore tramite gpio del raspberry
|
# Nessun driver definito, esegue la lettura del sensore tramite gpio del raspberry
|
||||||
if [ -z "$fnc" ]; then
|
if [ -z "$fnc" ]; then
|
||||||
log_write "Driver not found: $idx"
|
log_write "drv" "error" "Driver not found: $idx"
|
||||||
message_write "warning" "Driver not found: $idx"
|
message_write "warning" "Driver not found: $idx"
|
||||||
# Il driver definito non è stato trovato
|
# Il driver definito non è stato trovato
|
||||||
elif [ "$fnc" == "drvnotfound" ]; then
|
elif [ "$fnc" == "drvnotfound" ]; then
|
||||||
log_write "Driver not found: $idx"
|
log_write "drv" "error" "Driver not found: $idx"
|
||||||
message_write "warning" "Driver not found: $idx"
|
message_write "warning" "Driver not found: $idx"
|
||||||
else
|
else
|
||||||
echo "$(date) $fnc arg:$idx" >> "$LOG_OUTPUT_DRV_FILE"
|
echo "$(date) $fnc arg:$idx" >> "$LOG_OUTPUT_DRV_FILE"
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
function check_rain_online {
|
function check_rain_online {
|
||||||
|
|
||||||
if [ "$WEATHER_SERVICE" == "none" ]; then
|
if [ "$WEATHER_SERVICE" == "none" ]; then
|
||||||
log_write "check_rain_online - online service is disable"
|
log_write "rain" "warning" "check_rain_online - online service is disabled"
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -17,7 +17,7 @@ function check_rain_online {
|
|||||||
|
|
||||||
if [[ $local_epoch =~ ^-?[0-9]+$ ]]; then
|
if [[ $local_epoch =~ ^-?[0-9]+$ ]]; then
|
||||||
if [ $local_epoch -eq 0 ]; then
|
if [ $local_epoch -eq 0 ]; then
|
||||||
log_write "check_rain_online - failed read online data"
|
log_write "rain" "error" "check_rain_online - failed read online data"
|
||||||
else
|
else
|
||||||
if [ $local_epoch -gt 0 ]; then
|
if [ $local_epoch -gt 0 ]; then
|
||||||
current_state_rain_online='rain'
|
current_state_rain_online='rain'
|
||||||
@@ -27,14 +27,14 @@ function check_rain_online {
|
|||||||
fi
|
fi
|
||||||
weather=$(cat "$STATUS_DIR/last_weather_online" | $JQ -M ".weather")
|
weather=$(cat "$STATUS_DIR/last_weather_online" | $JQ -M ".weather")
|
||||||
|
|
||||||
log_write "check_rain_online - weather=$weather, local_epoch=$local_epoch"
|
log_write "rain" "info" "check_rain_online - weather=$weather, local_epoch=$local_epoch"
|
||||||
if [ "$current_state_rain_online" != "$last_state_rain_online" ]; then
|
if [ "$current_state_rain_online" != "$last_state_rain_online" ]; then
|
||||||
echo "$current_state_rain_online" > "$STATUS_DIR/last_state_rain_online"
|
echo "$current_state_rain_online" > "$STATUS_DIR/last_state_rain_online"
|
||||||
trigger_event "check_rain_online_change" "$current_state_rain_online" "$weather"
|
trigger_event "check_rain_online_change" "$current_state_rain_online" "$weather"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
log_write "check_rain_online - failed read online data"
|
log_write "rain" "error" "check_rain_online - failed read online data"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
trigger_event "check_rain_online_after" "$current_state_rain_online" "$weather"
|
trigger_event "check_rain_online_after" "$current_state_rain_online" "$weather"
|
||||||
@@ -57,11 +57,11 @@ function check_rain_sensor {
|
|||||||
current_state_rain_sensor='rain'
|
current_state_rain_sensor='rain'
|
||||||
local local_epoch=`date +%s`
|
local local_epoch=`date +%s`
|
||||||
echo $local_epoch > "$STATUS_DIR/last_rain_sensor"
|
echo $local_epoch > "$STATUS_DIR/last_rain_sensor"
|
||||||
log_write "check_rain_sensor - now it's raining ($local_epoch)"
|
log_write "rain" "info" "check_rain_sensor - now it's raining ($local_epoch)"
|
||||||
#return $local_epoch
|
#return $local_epoch
|
||||||
else
|
else
|
||||||
current_state_rain_sensor='norain'
|
current_state_rain_sensor='norain'
|
||||||
log_write "check_rain_sensor - now is not raining"
|
log_write "rain" "info" "check_rain_sensor - now is not raining"
|
||||||
fi
|
fi
|
||||||
if [ "$current_state_rain_sensor" != "$last_state_rain_sensor" ]; then
|
if [ "$current_state_rain_sensor" != "$last_state_rain_sensor" ]; then
|
||||||
echo "$current_state_rain_sensor" > "$STATUS_DIR/last_state_rain_sensor"
|
echo "$current_state_rain_sensor" > "$STATUS_DIR/last_state_rain_sensor"
|
||||||
@@ -69,7 +69,7 @@ function check_rain_sensor {
|
|||||||
fi
|
fi
|
||||||
trigger_event "check_rain_sensor_after" "$current_state_rain_sensor"
|
trigger_event "check_rain_sensor_after" "$current_state_rain_sensor"
|
||||||
else
|
else
|
||||||
log_write "Rain sensor not present"
|
log_write "rain" "warning" "Rain sensor not present"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -113,7 +113,7 @@ function close_all_for_rain {
|
|||||||
#echo "$al = $state"
|
#echo "$al = $state"
|
||||||
if [ "$state" = "1" ] && [ "$evnorain" != "1" ]; then
|
if [ "$state" = "1" ] && [ "$evnorain" != "1" ]; then
|
||||||
ev_close $al
|
ev_close $al
|
||||||
log_write "close_all_for_rain - Close solenoid '$al' for rain"
|
log_write "irrigate" "warning" "close_all_for_rain - Close solenoid '$al' for rain"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ function stop_socket_server {
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
log_write "stop socket server"
|
log_write "socket_server" "info" "stop socket server"
|
||||||
|
|
||||||
kill -9 $(list_descendants `cat "$TCPSERVER_PID_FILE"`) 2> /dev/null
|
kill -9 $(list_descendants `cat "$TCPSERVER_PID_FILE"`) 2> /dev/null
|
||||||
kill -9 `cat "$TCPSERVER_PID_FILE"` 2> /dev/null
|
kill -9 `cat "$TCPSERVER_PID_FILE"` 2> /dev/null
|
||||||
@@ -44,7 +44,7 @@ function socket_server_command {
|
|||||||
user=$(echo "$user" | $TR -d '[\r\n]')
|
user=$(echo "$user" | $TR -d '[\r\n]')
|
||||||
password=$(echo "$password" | $TR -d '[\r\n]')
|
password=$(echo "$password" | $TR -d '[\r\n]')
|
||||||
if [ "$user" != "$TCPSERVER_USER" ] || [ "$password" != "$TCPSERVER_PWD" ]; then
|
if [ "$user" != "$TCPSERVER_USER" ] || [ "$password" != "$TCPSERVER_PWD" ]; then
|
||||||
log_write "socket connection from: $TCPREMOTEIP - Bad socket server credentials - user:$user"
|
log_write "socket_server" "warning" "socket connection from: $TCPREMOTEIP - Bad socket server credentials - user:$user"
|
||||||
json_error 0 "Bad socket server credentials"
|
json_error 0 "Bad socket server credentials"
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
@@ -61,7 +61,7 @@ function socket_server_command {
|
|||||||
arg7=$(echo "$line " | $CUT -d ' ' -f7)
|
arg7=$(echo "$line " | $CUT -d ' ' -f7)
|
||||||
arg8=$(echo "$line " | $CUT -d ' ' -f8)
|
arg8=$(echo "$line " | $CUT -d ' ' -f8)
|
||||||
|
|
||||||
log_write "socket connection from: $TCPREMOTEIP - command: $arg1 $arg2 $arg3 $arg4 $arg5 $arg6 $arg7 $arg8"
|
log_write "socket_server" "info" "socket connection from: $TCPREMOTEIP - command: $arg1 $arg2 $arg3 $arg4 $arg5 $arg6 $arg7 $arg8"
|
||||||
|
|
||||||
#reset_messages &> /dev/null
|
#reset_messages &> /dev/null
|
||||||
|
|
||||||
@@ -102,6 +102,12 @@ function socket_server_command {
|
|||||||
json_status
|
json_status
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
cron_enable_all_open_close)
|
||||||
|
cron_enable_all_open_close &> /dev/null
|
||||||
|
message_write "success" "All solenoid enabled"
|
||||||
|
json_status
|
||||||
|
;;
|
||||||
|
|
||||||
set_general_cron)
|
set_general_cron)
|
||||||
local vret=""
|
local vret=""
|
||||||
for i in $arg2 $arg3 $arg4 $arg5 $arg6 $arg7
|
for i in $arg2 $arg3 $arg4 $arg5 $arg6 $arg7
|
||||||
@@ -121,7 +127,7 @@ function socket_server_command {
|
|||||||
|
|
||||||
if [[ ! -z $vret ]]; then
|
if [[ ! -z $vret ]]; then
|
||||||
json_error 0 "Cron set failed"
|
json_error 0 "Cron set failed"
|
||||||
log_write "Cron set failed: $vret"
|
log_write "socket_server" "error" "Cron set failed: $vret"
|
||||||
else
|
else
|
||||||
message_write "success" "Cron set successfull"
|
message_write "success" "Cron set successfull"
|
||||||
json_status
|
json_status
|
||||||
@@ -136,7 +142,7 @@ function socket_server_command {
|
|||||||
|
|
||||||
if [[ ! -z $vret ]]; then
|
if [[ ! -z $vret ]]; then
|
||||||
json_error 0 "Cron set failed"
|
json_error 0 "Cron set failed"
|
||||||
log_write "Cron del failed: $vret"
|
log_write "socket_server" "error" "Cron del failed: $vret"
|
||||||
else
|
else
|
||||||
message_write "success" "Cron set successfull"
|
message_write "success" "Cron set successfull"
|
||||||
json_status
|
json_status
|
||||||
@@ -151,7 +157,7 @@ function socket_server_command {
|
|||||||
|
|
||||||
if [[ ! -z $vret ]]; then
|
if [[ ! -z $vret ]]; then
|
||||||
json_error 0 "Cron del failed"
|
json_error 0 "Cron del failed"
|
||||||
log_write "Cron del failed: $vret"
|
log_write "socket_server" "error" "Cron del failed: $vret"
|
||||||
else
|
else
|
||||||
message_write "success" "Scheduled start successfully deleted"
|
message_write "success" "Scheduled start successfully deleted"
|
||||||
json_status "get_cron_open_in:$arg2"
|
json_status "get_cron_open_in:$arg2"
|
||||||
@@ -167,7 +173,7 @@ function socket_server_command {
|
|||||||
|
|
||||||
if [[ ! -z $vret ]]; then
|
if [[ ! -z $vret ]]; then
|
||||||
json_error 0 "Cron set failed"
|
json_error 0 "Cron set failed"
|
||||||
log_write "Cron set failed: $vret"
|
log_write "socket_server" "error" "Cron set failed: $vret"
|
||||||
else
|
else
|
||||||
message_write "success" "Cron set successfull"
|
message_write "success" "Cron set successfull"
|
||||||
json_status
|
json_status
|
||||||
@@ -182,7 +188,7 @@ function socket_server_command {
|
|||||||
|
|
||||||
if [[ ! -z $vret ]]; then
|
if [[ ! -z $vret ]]; then
|
||||||
json_error 0 "Cron set failed"
|
json_error 0 "Cron set failed"
|
||||||
log_write "Cron set failed: $vret"
|
log_write "socket_server" "error" "Cron set failed: $vret"
|
||||||
else
|
else
|
||||||
message_write "success" "Cron set successfull"
|
message_write "success" "Cron set successfull"
|
||||||
json_status
|
json_status
|
||||||
@@ -197,7 +203,7 @@ function socket_server_command {
|
|||||||
|
|
||||||
if [[ ! -z $vret ]]; then
|
if [[ ! -z $vret ]]; then
|
||||||
json_error 0 "Cron set failed"
|
json_error 0 "Cron set failed"
|
||||||
log_write "Cron set failed: $vret"
|
log_write "socket_server" "error" "Cron set failed: $vret"
|
||||||
else
|
else
|
||||||
message_write "success" "Cron set successfull"
|
message_write "success" "Cron set successfull"
|
||||||
json_status
|
json_status
|
||||||
@@ -212,7 +218,7 @@ function socket_server_command {
|
|||||||
|
|
||||||
if [[ ! -z $vret ]]; then
|
if [[ ! -z $vret ]]; then
|
||||||
json_error 0 "piGardenSched command failed"
|
json_error 0 "piGardenSched command failed"
|
||||||
log_write "piGardenSched command failed: $vret"
|
log_write "socket_server" "error" "piGardenSched command failed: $vret"
|
||||||
else
|
else
|
||||||
message_write "success" "Schedule set successfull"
|
message_write "success" "Schedule set successfull"
|
||||||
json_status
|
json_status
|
||||||
|
|||||||
62
piGarden.sh
62
piGarden.sh
@@ -10,7 +10,7 @@
|
|||||||
#
|
#
|
||||||
function initialize {
|
function initialize {
|
||||||
|
|
||||||
log_write "Run initialize"
|
log_write "general" "info" "Run initialize"
|
||||||
|
|
||||||
unlock
|
unlock
|
||||||
|
|
||||||
@@ -50,13 +50,13 @@ function initialize {
|
|||||||
# Inizializza il sensore di rilevamento pioggia
|
# Inizializza il sensore di rilevamento pioggia
|
||||||
if [ -n "$RAIN_GPIO" ]; then
|
if [ -n "$RAIN_GPIO" ]; then
|
||||||
drv_rain_sensor_init "$RAIN_GPIO"
|
drv_rain_sensor_init "$RAIN_GPIO"
|
||||||
log_write "Rain sensor initialized"
|
log_write "rain" "info" "Rain sensor initialized"
|
||||||
else
|
else
|
||||||
log_write "Rain sensor not present"
|
log_write "rain" "info" "Rain sensor not present"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
trigger_event "init_after" ""
|
trigger_event "init_after" ""
|
||||||
log_write "End initialize"
|
log_write "general" "info" "End initialize"
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -98,7 +98,7 @@ function ev_open {
|
|||||||
message_write "warning" "Solenoid not open for rain"
|
message_write "warning" "Solenoid not open for rain"
|
||||||
trigger_event "ev_not_open_for_rain_online" "$1"
|
trigger_event "ev_not_open_for_rain_online" "$1"
|
||||||
trigger_event "ev_not_open_for_rain" "$1"
|
trigger_event "ev_not_open_for_rain" "$1"
|
||||||
log_write "Solenoid '$1' not open for rain (online check)"
|
log_write "irrigate" "warning" "Solenoid '$1' not open for rain (online check)"
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
@@ -113,7 +113,7 @@ function ev_open {
|
|||||||
message_write "warning" "Solenoid not open for rain"
|
message_write "warning" "Solenoid not open for rain"
|
||||||
trigger_event "ev_not_open_for_rain_sensor" "$1"
|
trigger_event "ev_not_open_for_rain_sensor" "$1"
|
||||||
trigger_event "ev_not_open_for_rain" "$1"
|
trigger_event "ev_not_open_for_rain" "$1"
|
||||||
log_write "Solenoid '$1' not open for rain (sensor check)"
|
log_write "irrigate" "warning" "Solenoid '$1' not open for rain (sensor check)"
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
@@ -126,7 +126,7 @@ function ev_open {
|
|||||||
|
|
||||||
trigger_event "ev_open_before" "$1" "$2"
|
trigger_event "ev_open_before" "$1" "$2"
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
log_write "Solenoid '$1' not open due to external event"
|
log_write "irrigate" "warning" "Solenoid '$1' not open due to external event"
|
||||||
message_write 'warning' "Solenoid not open due to external event"
|
message_write 'warning' "Solenoid not open due to external event"
|
||||||
mqtt_status
|
mqtt_status
|
||||||
return
|
return
|
||||||
@@ -150,7 +150,7 @@ function ev_open {
|
|||||||
|
|
||||||
ev_set_state $EVNUM $state
|
ev_set_state $EVNUM $state
|
||||||
|
|
||||||
log_write "Solenoid '$1' open"
|
log_write "irrigate" "info" "Solenoid '$1' open"
|
||||||
message_write "success" "Solenoid open"
|
message_write "success" "Solenoid open"
|
||||||
|
|
||||||
trigger_event "ev_open_after" "$1" "$2"
|
trigger_event "ev_open_after" "$1" "$2"
|
||||||
@@ -259,7 +259,7 @@ function ev_close {
|
|||||||
|
|
||||||
ev_set_state $EVNUM 0
|
ev_set_state $EVNUM 0
|
||||||
|
|
||||||
log_write "Solenoid '$1' close"
|
log_write "irrigate" "info" "Solenoid '$1' close"
|
||||||
message_write "success" "Solenoid close"
|
message_write "success" "Solenoid close"
|
||||||
|
|
||||||
trigger_event "ev_close_after" "$1"
|
trigger_event "ev_close_after" "$1"
|
||||||
@@ -285,7 +285,9 @@ function supply_negative {
|
|||||||
|
|
||||||
#
|
#
|
||||||
# Scrive un messaggio nel file di log
|
# Scrive un messaggio nel file di log
|
||||||
# $1 log da scrivere
|
# $1 type
|
||||||
|
# $2 level
|
||||||
|
# $3 log da scrivere
|
||||||
#
|
#
|
||||||
function log_write {
|
function log_write {
|
||||||
if [ -e "$LOG_FILE" ]; then
|
if [ -e "$LOG_FILE" ]; then
|
||||||
@@ -304,7 +306,25 @@ function log_write {
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo -e "`date`\t\t$1" >> $LOG_FILE
|
echo -e "`date`\t\t$1\t$2\t$3" >> $LOG_FILE
|
||||||
|
|
||||||
|
log_send "$1" "$2" "`date '+%Y-%m-%d %H:%M:%S'`" "$3"
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#
|
||||||
|
# Invia un log verso piGardenWeb
|
||||||
|
# $1 type
|
||||||
|
# $2 level
|
||||||
|
# $3 date time
|
||||||
|
# $4 messaggio
|
||||||
|
#
|
||||||
|
function log_send {
|
||||||
|
|
||||||
|
if [[ ! -z "$LOG_URL" ]]; then
|
||||||
|
$CURL $LOG_CURL_PARAM "$LOG_URL" -d "api_token=$LOG_API_TOKEN&type=$1&level=$2&datetime_log=$3&message=$4" &> /dev/null &
|
||||||
|
fi
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
@@ -373,7 +393,7 @@ function gpio_alias2number {
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
log_write "ERROR solenoid alias not found: $1"
|
log_write "general" "error" "ERROR solenoid alias not found: $1"
|
||||||
message_write "warning" "Solenoid alias not found"
|
message_write "warning" "Solenoid alias not found"
|
||||||
mqtt_status
|
mqtt_status
|
||||||
exit 1
|
exit 1
|
||||||
@@ -393,7 +413,7 @@ function ev_alias2number {
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
log_write "ERROR solenoid alias not found: $1"
|
log_write "general" "error" "ERROR solenoid alias not found: $1"
|
||||||
message_write "warning" "Solenoid alias not found"
|
message_write "warning" "Solenoid alias not found"
|
||||||
mqtt_status
|
mqtt_status
|
||||||
exit 1
|
exit 1
|
||||||
@@ -480,7 +500,7 @@ function close_all {
|
|||||||
#echo "$al = $state"
|
#echo "$al = $state"
|
||||||
if [[ "$state" -gt "0" || "$1" = "force" ]]; then
|
if [[ "$state" -gt "0" || "$1" = "force" ]]; then
|
||||||
ev_close $al
|
ev_close $al
|
||||||
log_write "close_all - Close solenoid '$al' for rain"
|
log_write "irrigate" "info" "close_all - Close solenoid '$al' for rain"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
@@ -779,12 +799,12 @@ function lock {
|
|||||||
local foo=bar
|
local foo=bar
|
||||||
else
|
else
|
||||||
if [ "$current_time" -gt "$max_time" ]; then
|
if [ "$current_time" -gt "$max_time" ]; then
|
||||||
log_write "Maximum locked time reached"
|
log_write "general" "error" "Maximum locked time reached"
|
||||||
sleep $max_time
|
sleep $max_time
|
||||||
unlock
|
unlock
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
log_write "Sleep 1 second for locked state"
|
log_write "general" "info" "Sleep 1 second for locked state"
|
||||||
sleep 1
|
sleep 1
|
||||||
lock $current_time
|
lock $current_time
|
||||||
return
|
return
|
||||||
@@ -833,7 +853,7 @@ function send_identifier {
|
|||||||
fi
|
fi
|
||||||
echo "$ID" > "$FILE_ID"
|
echo "$ID" > "$FILE_ID"
|
||||||
|
|
||||||
log_write "Send installation identifier to collect usage"
|
log_write "general" "info" "Send installation identifier to collect usage"
|
||||||
|
|
||||||
$CURL https://www.lejubila.net/statistic/collect_usage/piGarden/$ID/$VERSION/$SUB_VERSION/$RELEASE_VERSION > /dev/null 2>&1
|
$CURL https://www.lejubila.net/statistic/collect_usage/piGarden/$ID/$VERSION/$SUB_VERSION/$RELEASE_VERSION > /dev/null 2>&1
|
||||||
|
|
||||||
@@ -875,7 +895,7 @@ function cmd_pigardensched {
|
|||||||
|
|
||||||
if [ $PIGARDENSCHED == 0 ]; then
|
if [ $PIGARDENSCHED == 0 ]; then
|
||||||
echo "piGardenSched not configured in piGarden" >&2
|
echo "piGardenSched not configured in piGarden" >&2
|
||||||
log_write "piGardenSched not configured in piGarden"
|
log_write "piGardenSched" "error" "piGardenSched not configured in piGarden"
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -983,8 +1003,8 @@ function debug2 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
VERSION=0
|
VERSION=0
|
||||||
SUB_VERSION=5
|
SUB_VERSION=6
|
||||||
RELEASE_VERSION=14
|
RELEASE_VERSION=1
|
||||||
|
|
||||||
DIR_SCRIPT=`dirname $0`
|
DIR_SCRIPT=`dirname $0`
|
||||||
NAME_SCRIPT=${0##*/}
|
NAME_SCRIPT=${0##*/}
|
||||||
@@ -1130,7 +1150,7 @@ case "$1" in
|
|||||||
nohup $0 start_socket_server_daemon > /dev/null 2>&1 &
|
nohup $0 start_socket_server_daemon > /dev/null 2>&1 &
|
||||||
|
|
||||||
echo "Daemon is started widh pid $!"
|
echo "Daemon is started widh pid $!"
|
||||||
log_write "start socket server with pid $!"
|
log_write "socket_server" "info" "start socket server with pid $!"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
start_socket_server_daemon)
|
start_socket_server_daemon)
|
||||||
|
|||||||
Reference in New Issue
Block a user