diff --git a/sms_send_tosend.sh b/sms_send_tosend.sh index 67aaed5..4fb199e 100755 --- a/sms_send_tosend.sh +++ b/sms_send_tosend.sh @@ -14,6 +14,25 @@ G1PUB=$(cat /home/${YOU}/.zen/secret.dunikey | grep 'pub:' | cut -d ' ' -f 2) ## STOP GAMMU-SMSD sudo service gammu-smsd stop +######################################################################## +######################################################################## +echo "RETRY ERROR MESSAGE" +for tosend in /home/${YOU}/.zen/SMS/PHONE/*/*.tosend.sh.error.txt; do + phonehash=$(echo "${tosend}" | cut -d '/' -f 7) && [[ $phonehash == "*" ]] && continue + xzuid=$(cat "/home/${YOU}/.zen/SMS/PHONE/${phonehash}/xzuid.txt") + [[ ! $xzuid ]] && echo "ERROR $tosend" && continue + + ./sms/natools.py decrypt -f pubsec -k "/home/${YOU}/.zen/secret.dunikey" -i "/home/${YOU}/.zen/SMS/PHONE/${phonehash}/passwd.encrypt" -o "/tmp/${phonehash}.phone" + phone=$(cat /tmp/${phonehash}.phone) + echo "SENDING ${phone}" + ## PREPARE SMS + cat "${tosend}" | sed "s/_PHONE_/${phone}/g" | sed "s/_ID_/${xzuid}/g" > /tmp/tosend.sh && chmod +x /tmp/tosend.sh + ## SEND SMS & ARCHIVE RESULT (error?) + bash -x /tmp/tosend.sh && mv ${tosend} ${tosend}.txt && rm /tmp/tosend.sh || mv ${tosend} ${tosend}.error.txt + sleep 3 +done + +######################################################################## ######################################################################## echo "SEARCHING FOR SMS TO SEND TO USERS" for tosend in /home/${YOU}/.zen/SMS/PHONE/*/*.tosend.sh; do @@ -32,6 +51,7 @@ for tosend in /home/${YOU}/.zen/SMS/PHONE/*/*.tosend.sh; do sleep 3 done +######################################################################## ######################################################################## echo "SEARCHING FOR GUIDE SMS TO SEND TO GUILDE USERS" for guidesend in /home/${YOU}/.zen/SMS/GUILDES/*/OUTPUT/*.tosend.sh; do @@ -57,23 +77,7 @@ for guidesend in /home/${YOU}/.zen/SMS/GUILDES/*/OUTPUT/*.tosend.sh; do mv ${guidesend} ${guidesend}.txt done -######################################################################## -######################################################################## -echo "RETRY ERROR MESSAGE" -for tosend in /home/${YOU}/.zen/SMS/PHONE/*/*.tosend.sh.error.txt; do - phonehash=$(echo "${tosend}" | cut -d '/' -f 7) && [[ $phonehash == "*" ]] && continue - xzuid=$(cat "/home/${YOU}/.zen/SMS/PHONE/${phonehash}/xzuid.txt") - [[ ! $xzuid ]] && echo "ERROR $tosend" && continue - ./sms/natools.py decrypt -f pubsec -k "/home/${YOU}/.zen/secret.dunikey" -i "/home/${YOU}/.zen/SMS/PHONE/${phonehash}/passwd.encrypt" -o "/tmp/${phonehash}.phone" - phone=$(cat /tmp/${phonehash}.phone) - echo "SENDING ${phone}" - ## PREPARE SMS - cat "${tosend}" | sed "s/_PHONE_/${phone}/g" | sed "s/_ID_/${xzuid}/g" > /tmp/tosend.sh && chmod +x /tmp/tosend.sh - ## SEND SMS & ARCHIVE RESULT (error?) - bash -x /tmp/tosend.sh && mv ${tosend} ${tosend}.txt && rm /tmp/tosend.sh || mv ${tosend} ${tosend}.error.txt - sleep 3 -done ## REINIT gammu-smsd spool sudo rm /var/spool/gammu/inbox/* 2>/dev/null