Suppression d'instruction pour le debug

This commit is contained in:
Beu 2017-11-22 13:40:08 +01:00
parent 9ef990de15
commit bce17c58c0

View File

@ -1,41 +1,40 @@
#!/bin/bash
SECRETKEY=''
PHONENUM=''
DATE=`date --date="1 minute ago" +'%Y-%m-%d %H:%M:%S'`
OTP=`oathtool -w 3 --now="$DATE" --totp -b $SECRETKEY`
OTPFROMCLIENT=`echo $SMS_1_TEXT | awk '{print $NF}'`
CMD=`echo $SMS_1_TEXT | awk '{print tolower($1)}'`
TEXT=`echo $SMS_1_TEXT | awk '{for (i=2; i<NF; i++) print $i}'`
MATCH=`echo $OTP | grep $OTPFROMCLIENT`
echo $OTP >> /var/log/gammu_receive.log
if [[ $SMS_1_NUMBER -eq $PHONENUM ]]; then
if [[ -n $MATCH ]] ;then
case $CMD in
allo)
REPLY="A l'huile"
;;
ping)
REPLY=`ping -n -c 2 $TEXT`
;;
reboot)
ssh root@"$TEXT" 'sudo reboot'
REPLY="Signal reboot envoyé"
;;
cmd)
HOST=`echo $SMS_1_TEXT | awk '{print $2}'`
COMMAND=`echo $SMS_1_TEXT | awk '{for (i=3; i<NF; i++) print $i}'`
REPLY=`ssh -oStrictHostKeyChecking=no root@$HOST $COMMAND`
esac
else
REPLY="Mauvais OTP"
fi
else
REPLY="FROM: $SMS_1_NUMBER TEXT: $SMS_1_TEXT"
fi
#!/bin/bash
SECRETKEY=''
PHONENUM=''
DATE=`date --date="1 minute ago" +'%Y-%m-%d %H:%M:%S'`
OTP=`oathtool -w 3 --now="$DATE" --totp -b $SECRETKEY`
OTPFROMCLIENT=`echo $SMS_1_TEXT | awk '{print $NF}'`
CMD=`echo $SMS_1_TEXT | awk '{print tolower($1)}'`
TEXT=`echo $SMS_1_TEXT | awk '{for (i=2; i<NF; i++) print $i}'`
MATCH=`echo $OTP | grep $OTPFROMCLIENT`
if [[ $SMS_1_NUMBER -eq $PHONENUM ]]; then
if [[ -n $MATCH ]] ;then
case $CMD in
allo)
REPLY="A l'huile"
;;
ping)
REPLY=`ping -n -c 2 $TEXT`
;;
reboot)
ssh root@"$TEXT" 'sudo reboot'
REPLY="Signal reboot envoyé"
;;
cmd)
HOST=`echo $SMS_1_TEXT | awk '{print $2}'`
COMMAND=`echo $SMS_1_TEXT | awk '{for (i=3; i<NF; i++) print $i}'`
REPLY=`ssh -oStrictHostKeyChecking=no root@$HOST $COMMAND`
esac
else
REPLY="Mauvais OTP"
fi
else
REPLY="FROM: $SMS_1_NUMBER TEXT: $SMS_1_TEXT"
fi
/usr/bin/sudo /usr/bin/gammu-smsd-inject TEXT $PHONENUM -len 999 -textutf8 "$REPLY"