2016-06-17 119 views
0

我的第一篇文章尋求幫助。短信回覆腳本gammu

下面的腳本也希望這樣做:

,接收短信,如果有50%的回覆,併發布事件

然後驗證答覆對一個範圍1-10,如果在範圍內,並從相同的號碼恢復消息或者用不同的消息恢復。

當它回覆第二條消息時,該號碼將恢復爲所有其他消息。

您認爲如何?

#!/bin/sh 
from=$SMS_1_NUMBER 
message=$SMS_1_TEXT 
gammu-smsd[939]: Process failed with exit status 111 

if test "$message" = "50%"; then 
    reply="BRAVO DWSTE TO NOUMERO TRAPEZIOU!" 
    delay 1 
    curl "http://10.18.214.12:9999/sendLocalEvent?eventName=event1" 
    if test [ "$message" -ge 1 -a "$message" -le 10 ] && [ "$from" = "$from" ] ; then 
    reply="-50% DIKO SAS" 
    delay 1 
    curl "http://10.18.214.12:9999/sendLocalEvent?eventName=event2&eventParam=e[ "$message" ]" 
    else 
     if [ "$from" = "$from" ]; then 
      reply="TO NOUMERO TOY TRAPEZIOU EINAI LATHOS" 
     else 
      reply="O NHKHTHS VRETHIKE EYXARISTOYME" 
     fi 
     echo "$reply" | sudo gammu sendsms TEXT "$from" 
    sendto="694" 
    message=$SMS_1_TEXT 
    from=$SMS_1_NUMBER 
    echo "$from\n$message" | sudo gammu sendsms TEXT "$sendto" 
    fi 
    echo "$reply" | sudo gammu sendsms TEXT "$from" 
elif test "$message" = "Ping"; then 
    reply="Pong!" 
else 
    reply="PARAKALW PROSPATHISTE XANA" 
fi 
echo "$reply" | sudo gammu sendsms TEXT "$from" 

回答