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