Browse Source

modificato sistema di messaggio: al posto di >> ho messo | tee

mauro 2 months ago
parent
commit
3a392e00a0
2 changed files with 9 additions and 9 deletions
  1. 8 8
      go.sh
  2. 1 1
      load.sh

+ 8 - 8
go.sh

@@ -10,7 +10,7 @@ data=$(date)
 log=$(mktemp)
 
 if [ __${tempo}__ == ____ ] ; then
-  echo "non e' stato indicato il tempo, si va in automatico" >> ${log}
+  echo "non e' stato indicato il tempo, si va in automatico" | tee ${log}
   tempo=30s
 fi
 
@@ -20,15 +20,15 @@ echo "pompa: ${pompa}" |tee -a ${log}
 echo "tempo: ${tempo}" |tee -a ${log}
 echo ""
 
-# verifica la presenza del file "irrigatore" >> ${log}
+# verifica la presenza del file "irrigatore" 
 if [ -f  ~/script/irrigatore ]; then 
-  echo "File 'irrigatore' presente" >> ${log}
-  echo "Apro valvola ${linea} per ${tempo}"  >> ${log}
+  echo "File 'irrigatore' presente" | tee ${log}
+  echo "Apro valvola ${linea} per ${tempo}"  | tee ${log}
   raspi-gpio set ${linea} dl 
   mosquitto_pub -h nuc -p 1883 -u swarn  -P "Abcd.1234" -t "Status" -m "{\"irrigatore\":${linea},\"status\":$(pinctrl lev ${linea})}"
 
   if [ ${pompasi} == 1 ]; then
-    echo "Accendo pompa ${pompa}" >> ${log}
+    echo "Accendo pompa ${pompa}" | tee ${log}
     raspi-gpio set ${pompa} dl
     mosquitto_pub -h nuc -p 1883 -u swarn  -P "Abcd.1234" -t "Status" -m "{\"pompa\":${pompa},\"status\":$(pinctrl lev ${pompa})}"
   fi
@@ -37,16 +37,16 @@ if [ -f  ~/script/irrigatore ]; then
   sleep ${tempo}
 
   if [ ${pompasi} == 1 ]; then
-    echo "Spengo pompa ${pompa}" >> ${log}
+    echo "Spengo pompa ${pompa}" | tee ${log}
     raspi-gpio set ${pompa} dh
     mosquitto_pub -h nuc -p 1883 -u swarn  -P "Abcd.1234" -t "Status" -m "{\"pompa\":${pompa},\"status\":$(pinctrl lev ${pompa})}"
   fi
 
-  echo "Chiudo valvola ${linea}" >> ${log}
+  echo "Chiudo valvola ${linea}" | tee ${log}
   raspi-gpio set ${linea} dh
   mosquitto_pub -h nuc -p 1883 -u swarn  -P "Abcd.1234" -t "Status" -m "{\"irrigatore\":${linea},\"status\":$(pinctrl lev ${linea})}"
 else
-  echo "Accensione linea ${linea} per ${tempo}\nDisattivata: manca file 'irrigatore' in home" >> ${log}
+  echo -e "Accensione linea ${linea} per ${tempo}\nDisattivata: manca file 'irrigatore' in home" | tee  ${log}
 fi
 
 cat ${log} | mail -s "${data}: linea ${linea} per ${tempo}" root

+ 1 - 1
load.sh

@@ -63,7 +63,7 @@ if [ -f  ~/script/pompa ]; then
   mosquitto_pub -h nuc -p 1883 -u swarn  -P "Abcd.1234" -t "Status" -m "{\"valvola\":${linea},\"status\":$(pinctrl lev ${linea})}"
 
 else
-  echo "Accensione linea ${linea} per ${tempo}\nDisattivata: manca file 'irrigatore' in home" |tee -a ${log}
+  echo -e "Accensione linea ${linea} per ${tempo}\nDisattivata: manca file 'irrigatore' in home" |tee -a ${log}
 fi
 
 cat ${log} | mail -s "${data}: linea ${linea} per ${tempo}" root