ed:scripts/caldera.sh linea 37 [ if nonzero_length ]

This commit is contained in:
jp.av.dev 2021-08-04 16:07:52 -04:00
parent 43241d681f
commit f6a008bf46

View File

@ -11,18 +11,10 @@ estado_caldera() {
[[ ${arRS[1]} = "0" ]] && echo " - APAGADO - " [[ ${arRS[1]} = "0" ]] && echo " - APAGADO - "
echo "------------------------------" echo "------------------------------"
case ${arRS[0]} in case ${arRS[0]} in
'1') '1') echo " Modo Automático " ;;
echo " Modo Automático " '5') echo " Modo Manual " ;;
;; '6') echo " Modo Libre " ;;
'5') *) echo " verificar conexión! " ;;
echo " Modo Manual "
;;
'6')
echo " Modo Libre "
;;
*)
echo " verificar conexión! "
;;
esac esac
echo "------------------------------" echo "------------------------------"
for i in {10..14}; do [[ ${arRS[${i}]} -lt 10 ]] && arRS[${i}]="0"${arRS[${i}]}; done for i in {10..14}; do [[ ${arRS[${i}]} -lt 10 ]] && arRS[${i}]="0"${arRS[${i}]}; done
@ -39,35 +31,20 @@ estado_caldera() {
ejec_orden() { ejec_orden() {
ORD="" ORD=""
case $1 in case $1 in
2) 2) ORD="/sethora?1=2&2=${2}&3=${3}&4=${4}&5=${5}&6=${6}&7=${7}" ;;
ORD="/sethora?1=2&2=${2}&3=${3}&4=${4}&5=${5}&6=${6}&7=${7}" 3) ORD="/horasAcc?1=3&2=${2}&3=${3}&4=${4}&5=${5}" ;;
;; 4) ORD="/setservo?1=4&2=${2}&3=${3}&4=${4}&5=${5}" ;;
3) 5) if [ -n ${2} ]; then
ORD="/horasAcc?1=3&2=${2}&3=${3}&4=${4}&5=${5}" if [ ${2} = "on" ]; then
;;
4)
ORD="/setservo?1=4&2=${2}&3=${3}&4=${4}&5=${5}"
;;
5)
if [ ! -n ${2} ]
then
if [ ${2} = "on" ]
then
ORD="/accion?1=5&2=on" ORD="/accion?1=5&2=on"
elif [ ${2} = "off" ] elif [ ${2} = "off" ]; then
then
ORD="/accion?1=5&2=off" ORD="/accion?1=5&2=off"
fi fi
else else
return return
fi fi ;;
;; 6) ORD="/setlibre?1=6&2=${1}" ;;
6) *) ORD="" ;;
ORD="/setlibre?1=6&2=${1}"
;;
*)
ORD=""
;;
esac esac
curl -s "${IP_CALDERA}${ORD}" curl -s "${IP_CALDERA}${ORD}"
} }
@ -85,10 +62,7 @@ principal() {
echo echo
read -p " Ingresa Opcion :" OPC read -p " Ingresa Opcion :" OPC
case ${OPC} in case ${OPC} in
"1") "1") echo; curl -s "${IP_CALDERA}/auto" ;;
echo
curl -s "${IP_CALDERA}/auto"
;;
"2") "2")
clear clear
echo "============================" echo "============================"
@ -162,9 +136,7 @@ principal() {
echo echo
ejec_orden 6 ${MANUAL} ejec_orden 6 ${MANUAL}
;; ;;
"0") "0") exit ;;
exit
;;
esac esac
sleep 8 sleep 8
principal principal