#!/bin/bash ######################################################################## # Author: Fred (support@qo-op.com) # Version: 0.1 # License: GPL (http://www.google.com/search?q=GPL) ######################################################################## MY_PATH="`dirname \"$0\"`" # relative MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized ######################################################################## YOU=$(ps auxf --sort=+utime | grep -w ipfs | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d " " -f 1) || er+=" ipfs daemon not running" [[ ! -f /home/${YOU}/.zen/secret.dunikey ]] && echo "Crypto is missing... please install 'astrXbian' TestNet" && exit 1 G1PUB=$(cat /home/${YOU}/.zen/secret.dunikey | grep 'pub:' | cut -d ' ' -f 2) ## STOP GAMMU-SMSD sudo service gammu-smsd stop 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) 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 "${phone}" cat "${tosend}" | sed "s/_PHONE_/${phone}/g" > /tmp/tosend.sh && chmod +x /tmp/tosend.sh bash -x /tmp/tosend.sh && mv ${tosend} ${tosend}.done && rm /tmp/tosend.sh || mv ${tosend} ${tosend}.error 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 guilde=$(echo "$guidesend" | cut -d '/' -f 7) [[ ! -d /home/${YOU}/.zen/SMS/GUILDES/${guilde} ]] && continue for phonelink in /home/${YOU}/.zen/SMS/GUILDES/${guilde}/MEMBERS/*; do [[ ! -L $phonelink ]] && continue phone=$(echo "$phonelink" | cut -d '/' -f 9) cat "${guidesend}" | sed "s/_PHONE_/${phone}/g" > /tmp/guidesend.sh && chmod +x /tmp/guidesend.sh bash -x /tmp/guidesend.sh && mv ${guidesend} ${guidesend}.done && rm /tmp/guidesend.sh || mv ${guidesend} ${guidesend}.error sleep 3 done done ## START GAMMU-SMSD sudo service gammu-smsd start