aggiunto sistema di invio identificativo installazione per uso statistico
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
Add credentials support to socket server (define TCPSERVER_USER and TCPSERVER_PWD in your config file)
|
||||
Add management lock/unlock for prevent concurrente call to open/close solenoid
|
||||
Added the ability to enter an open / close schedule in disabled mode
|
||||
Add send statistic information to remote server
|
||||
|
||||
## 0.3.1 - 13/05/2017
|
||||
Add experimental support for monostable solenoid valve:
|
||||
|
||||
@@ -117,3 +117,7 @@ TCPSERVER_PORT="8084"
|
||||
# Utente e password che i clients devono utilizzare per stabilire una connessione tramite socket server
|
||||
TCPSERVER_USER=""
|
||||
TCPSERVER_PWD=""
|
||||
|
||||
# Con impostato il valore 1 non invia l'identificativi per statistiche di utilizzo
|
||||
NO_SEND_IDENTIFIER=0
|
||||
|
||||
|
||||
30
piGarden.sh
30
piGarden.sh
@@ -1441,6 +1441,34 @@ function lock {
|
||||
|
||||
}
|
||||
|
||||
function send_identifier {
|
||||
|
||||
if [ "$NO_SEND_IDENTIFIER" == "1" ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
local FILE_ID="/tmp/pigarden.id"
|
||||
|
||||
if [ -f "$FILE_ID" ]; then
|
||||
# Se il file è più vecchio di un giorno esce
|
||||
local max_age_file=86400
|
||||
local time_file=`$STAT -c %Y "$FILE_ID"`
|
||||
local age_file=$((`date +"%s"` - $time_file ))
|
||||
if [ "$age_file" -lt "$max_age_file" ]; then
|
||||
return
|
||||
fi
|
||||
else
|
||||
local ID=`ifconfig | $GREP --color=never -o -E '([[:xdigit:]]{1,2}:){5}[[:xdigit:]]{1,2}' | head -1 | md5sum | $CUT -d" " -f 1`
|
||||
if [ -z "$ID" ]; then
|
||||
return;
|
||||
fi
|
||||
echo "$ID" > "$FILE_ID"
|
||||
fi
|
||||
|
||||
#$CURL https://www.lejubila.net/statistic/usage/piGarden/$ID/$VERSION/$SUB_VERSION/$RELEASE_VERSION > /dev/null
|
||||
|
||||
}
|
||||
|
||||
#
|
||||
# Chidue un lock
|
||||
#
|
||||
@@ -1487,6 +1515,7 @@ LAST_WARNING_FILE="$STATUS_DIR/last_worning"
|
||||
LAST_SUCCESS_FILE="$STATUS_DIR/last_success"
|
||||
|
||||
|
||||
# Elimina il file di lock se più vecchio di 11 secondi
|
||||
if [ -f "$LOCK_FILE" ]; then
|
||||
max_age_lock_file=11
|
||||
time_lock_file=`$STAT -c %Y "$LOCK_FILE"`
|
||||
@@ -1496,6 +1525,7 @@ if [ -f "$LOCK_FILE" ]; then
|
||||
fi
|
||||
fi
|
||||
|
||||
send_identifier &
|
||||
|
||||
case "$1" in
|
||||
init)
|
||||
|
||||
Reference in New Issue
Block a user