retry error first
parent
39fd5a313f
commit
0604175f3e
|
@ -15,6 +15,25 @@ G1PUB=$(cat /home/${YOU}/.zen/secret.dunikey | grep 'pub:' | cut -d ' ' -f 2)
|
|||
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
|
||||
phonehash=$(echo "${tosend}" | cut -d '/' -f 7) && [[ $phonehash == "*" ]] && continue
|
||||
|
@ -33,6 +52,7 @@ for tosend in /home/${YOU}/.zen/SMS/PHONE/*/*.tosend.sh; do
|
|||
done
|
||||
|
||||
########################################################################
|
||||
########################################################################
|
||||
echo "SEARCHING FOR GUIDE SMS TO SEND TO GUILDE USERS"
|
||||
for guidesend in /home/${YOU}/.zen/SMS/GUILDES/*/OUTPUT/*.tosend.sh; do
|
||||
guilde=$(echo "$guidesend" | cut -d '/' -f 7) && [[ $guilde == "*" ]] && continue
|
||||
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue