Trigger sms_ACTION from EMAIL... TX TODO
This commit is contained in:
parent
73eca2426c
commit
43963548ea
|
@ -14,7 +14,7 @@ if [[ -f $MY_PATH/.install/.GPATH ]]; then source $MY_PATH/.install/.GPATH; fi
|
||||||
if [[ -f $MY_PATH/../.install/.GPATH ]]; then source $MY_PATH/../.install/.GPATH; fi
|
if [[ -f $MY_PATH/../.install/.GPATH ]]; then source $MY_PATH/../.install/.GPATH; fi
|
||||||
|
|
||||||
YOU=$(ps aux --sort=+utime | grep ipfs | tail -n 1 | cut -d " " -f 1)
|
YOU=$(ps aux --sort=+utime | grep ipfs | tail -n 1 | cut -d " " -f 1)
|
||||||
if [[ "$USER" != "root" ]]; then echo "Hey, $USER you must at least be admin of your system (sudo $0)"; exit; fi
|
#if [[ "$USER" != "root" ]]; then echo "Hey, $USER you must at least be admin of your system (sudo $0)"; exit; fi # BUG because cron USER=""
|
||||||
if [[ "$YOU" == "" || "$YOU" == "root" ]]; then echo "BAD IPFS. Aucune installation IPFS satisfaisante ici... Ciao $YOU !"; exit; fi
|
if [[ "$YOU" == "" || "$YOU" == "root" ]]; then echo "BAD IPFS. Aucune installation IPFS satisfaisante ici... Ciao $YOU !"; exit; fi
|
||||||
IPFSNODEID=$(su $YOU -c "ipfs id -f='<id>\n'")
|
IPFSNODEID=$(su $YOU -c "ipfs id -f='<id>\n'")
|
||||||
cd $GPATH
|
cd $GPATH
|
||||||
|
@ -22,14 +22,9 @@ source ./shell/init.sh
|
||||||
source ./shell/functions.sh
|
source ./shell/functions.sh
|
||||||
|
|
||||||
timebar=$(date +%H:%M)
|
timebar=$(date +%H:%M)
|
||||||
minut=$(date +%M)
|
minut=$(date +%M | sed 's/^0*//')
|
||||||
##################################################################
|
[[ $minut == "" ]] && minut=0
|
||||||
if [[ "$1" == "" ]]; then
|
log "__CRON:cron_MINUTE.sh - $minut - It is $timebar ... $1"
|
||||||
##################################################################
|
|
||||||
echo "$minut MN - It is $timebar in the morning, or in the night? It depends on your day..."
|
|
||||||
exit
|
|
||||||
fi
|
|
||||||
log "__CRON: $timebar $1"
|
|
||||||
##################################################################
|
##################################################################
|
||||||
|
|
||||||
##################################################################
|
##################################################################
|
||||||
|
@ -46,12 +41,12 @@ if [[ $(($minut%$EVERY)) == 0 ]]; then
|
||||||
TIMEBEFORE=$(date --date="-$EVERY minutes" +"%s")
|
TIMEBEFORE=$(date --date="-$EVERY minutes" +"%s")
|
||||||
[[ $NODE_G1PUBKEY == "" ]] && NODE_G1PUBKEY="5sdcypPRDrzEirtTqXwzvNnMwGpjXK6EhNdti8qsdS4h"
|
[[ $NODE_G1PUBKEY == "" ]] && NODE_G1PUBKEY="5sdcypPRDrzEirtTqXwzvNnMwGpjXK6EhNdti8qsdS4h"
|
||||||
TIMESTAMP=$(date +"%s")
|
TIMESTAMP=$(date +"%s")
|
||||||
log "GETTING last $EVERY mn TX : https://duniter-g1.p2p.legal/tx/history/$NODE_G1PUBKEY/times/$TIMEBEFORE/$TIMESTAMP"
|
#log "GETTING last $EVERY mn TX : https://duniter-g1.p2p.legal/tx/history/$NODE_G1PUBKEY/times/$TIMEBEFORE/$TIMESTAMP"
|
||||||
curl -s https://duniter-g1.p2p.legal/tx/history/$NODE_G1PUBKEY/times/$TIMEBEFORE/$TIMESTAMP | jq '.history.pending' | jq '.[].comment' > /tmp/scan.json
|
curl -s https://duniter-g1.p2p.legal/tx/history/$NODE_G1PUBKEY/times/$TIMEBEFORE/$TIMESTAMP | jq '.history.pending' | jq '.[].comment' > /tmp/scan.json
|
||||||
while read SMS_1_TEXT
|
while read SMS_1_TEXT
|
||||||
do
|
do
|
||||||
export $SMS_1_TEXT
|
export $SMS_1_TEXT
|
||||||
log "$NODE_G1PUBKEY TX RECEIVED !! COMMENT = " $SMS_1_TEXT
|
log "$NODE_G1PUBKEY TX PENDING !! COMMENT = " $SMS_1_TEXT
|
||||||
# TODO: VERIFY SOURCE PUBKEY IS RELATED TO A WALLET
|
# TODO: VERIFY SOURCE PUBKEY IS RELATED TO A WALLET
|
||||||
# PUBKEY=
|
# PUBKEY=
|
||||||
# WALLET=$(grep -Rwl "$PUBKEY" ./wallets/*/*.pub | head -n 1)
|
# WALLET=$(grep -Rwl "$PUBKEY" ./wallets/*/*.pub | head -n 1)
|
||||||
|
@ -90,7 +85,7 @@ while [[ $FROM != "" && $SUBJECT != "" ]]; do
|
||||||
curl -s --user "vir@g1sms.fr:Z1cG1V1r!" pop3://pop.bookmyname.com/1 --request dele --list-only
|
curl -s --user "vir@g1sms.fr:Z1cG1V1r!" pop3://pop.bookmyname.com/1 --request dele --list-only
|
||||||
cat ./email.txt | sed s/EMAIL/"${FROM}"/g | sed s/SUBJECT/"G1sms+ INCONNU"/g | sed s/MESSAGE/"Portefeuille G1sms inconnu"/g | ssmtp ${FROM}
|
cat ./email.txt | sed s/EMAIL/"${FROM}"/g | sed s/SUBJECT/"G1sms+ INCONNU"/g | sed s/MESSAGE/"Portefeuille G1sms inconnu"/g | ssmtp ${FROM}
|
||||||
fi
|
fi
|
||||||
log "NO MAIL"
|
#log "NO MAIL"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
@ -159,8 +154,12 @@ if [[ "$1" == "KALKUN" ]]; then
|
||||||
member=""
|
member=""
|
||||||
phone=$(echo $number | cut -d '/' -f 3);
|
phone=$(echo $number | cut -d '/' -f 3);
|
||||||
if [[ -f $number/$phone.uidname ]]; then member=$(cat $number/$phone.uidname); fi
|
if [[ -f $number/$phone.uidname ]]; then member=$(cat $number/$phone.uidname); fi
|
||||||
if [[ ! $member ]]; then member=$phone; fi
|
if [[ $phone && $member ]]; then
|
||||||
if [[ $phone && $member ]]; then add_contact $phone $member; log "__SUB:cron_MINUTE.sh: KALKUN add_contact $phone $member"; fi
|
rm_contact $phone $member;
|
||||||
|
sleep 2
|
||||||
|
add_contact $phone $member;
|
||||||
|
log "__SUB:cron_MINUTE.sh: KALKUN refresh contact $phone $member";
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
##################################################################
|
##################################################################
|
||||||
|
|
|
@ -124,14 +124,14 @@ su $YOU -c "ipfs get --output=./wallets_swarm/ /ipns/$IPFSNODEID"
|
||||||
count=1
|
count=1
|
||||||
# Search for All peers Nodes. TODO: To be changed when Swarm is too bug or not expendanding
|
# Search for All peers Nodes. TODO: To be changed when Swarm is too bug or not expendanding
|
||||||
#for id in ./wallets/.Qm*/;
|
#for id in ./wallets/.Qm*/;
|
||||||
for id in $(su $YOU -c "ipfs swarm peers" | awk -F '/' '{print $7}');
|
#for id in $(su $YOU -c "ipfs swarm peers" | awk -F '/' '{print $7}');
|
||||||
do
|
#do
|
||||||
count=$((count+1))
|
# count=$((count+1))
|
||||||
id=$(echo $id | cut -d '.' -f 3 | cut -d '/' -f 1)
|
# id=$(echo $id | cut -d '.' -f 3 | cut -d '/' -f 1)
|
||||||
log "__SUB:ipfs_swarm_wallets_refresh: IPFS: ipfs get --output=./wallets_swarm/ /ipns/$id"
|
# log "__SUB:ipfs_swarm_wallets_refresh: IPFS: ipfs get --output=./wallets_swarm/ /ipns/$id"
|
||||||
rm -Rf ./wallets_swarm/.$id
|
# rm -Rf ./wallets_swarm/.$id
|
||||||
./shell/timeout.sh -t 20 su $YOU -c "ipfs get --output=./wallets_swarm/ /ipns/$id"
|
# ./shell/timeout.sh -t 20 su $YOU -c "ipfs get --output=./wallets_swarm/ /ipns/$id"
|
||||||
done
|
#done
|
||||||
log "__SUB:ipfs_swarm_wallets_refresh: ./wallets_swarm/ RENEW from $count peers .........OK!!!"
|
log "__SUB:ipfs_swarm_wallets_refresh: ./wallets_swarm/ RENEW from $count peers .........OK!!!"
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -96,7 +96,7 @@ then
|
||||||
rm -f "./authfile"
|
rm -f "./authfile"
|
||||||
|
|
||||||
log_history $PHONE "G1BILLET, $TRANSAC, $BILLETPUBKEY"
|
log_history $PHONE "G1BILLET, $TRANSAC, $BILLETPUBKEY"
|
||||||
sleep 3
|
sleep 5
|
||||||
# Fill BILLET with TRANSAC amount
|
# Fill BILLET with TRANSAC amount
|
||||||
PAY=$(./silkaj/silkaj transaction --auth-scrypt -salt="$PHONE" -password="$PIN" --amount="$TRANSAC" --output="$BILLETPUBKEY" --comment="G1Billet $NUMBER" -y)
|
PAY=$(./silkaj/silkaj transaction --auth-scrypt -salt="$PHONE" -password="$PIN" --amount="$TRANSAC" --output="$BILLETPUBKEY" --comment="G1Billet $NUMBER" -y)
|
||||||
if [[ "$(echo $PAY | cut -d '|' -f 1)" != "KO" ]]; then
|
if [[ "$(echo $PAY | cut -d '|' -f 1)" != "KO" ]]; then
|
||||||
|
@ -131,7 +131,7 @@ then
|
||||||
done
|
done
|
||||||
|
|
||||||
# + G1SMS Commission
|
# + G1SMS Commission
|
||||||
sleep 2
|
sleep 10
|
||||||
COM=$(./silkaj/silkaj transaction --auth-scrypt -salt="$PHONE" -password="$PIN" --amount="$BILLCOM" --output="$NODE_G1PUBKEY" --comment="[G1sms+] Achat G1Billets" -y)
|
COM=$(./silkaj/silkaj transaction --auth-scrypt -salt="$PHONE" -password="$PIN" --amount="$BILLCOM" --output="$NODE_G1PUBKEY" --comment="[G1sms+] Achat G1Billets" -y)
|
||||||
|
|
||||||
# POUR IMPRIMER LES BILLETS! Brancher votre imprimante, configurer cups, activer code lp ;)
|
# POUR IMPRIMER LES BILLETS! Brancher votre imprimante, configurer cups, activer code lp ;)
|
||||||
|
|
Loading…
Reference in New Issue