Commit 59fde518 authored by zicmama's avatar zicmama

monitoring scripts

parent 0e6e7d1e
#######################################################################
# G1SMS
# Projet: SMS interface to G1 wallets (monnaie libre)
# Author: Fred (support@qo-op.com)
# Version: 0.2
# License: GPL (http://www.google.com/search?q=GPL)
# Code with Love & Music from https://play.zicmama.com/
#######################################################################
!SERVEUR
RaspberryPi3 & Dongle 3G/USB + Raspbian Lite & gammu, smsd
ex: https://tutoandco.colas-delmas.fr/software/envoyer-sms-gammu-deamon/
Activer 3G: https://nicovddussen.wordpress.com/2014/11/12/setting-up-your-raspberry-pi-to-work-with-a-3g-dongle/
# ######################################################################
# IMPERATIF! Installer dans /root/G1SMS/
# Configurer /etc/gammu-smsdrc
# Configuration file for Gammu SMS Daemon
# Gammu library configuration, see gammurc(5)
[gammu]
device = /dev/serial/by-id/usb-HUAWEI_Technologies_HUAWEI_Mobile-if01-port0
name = Phone on USB serial port HUAWEI_Technology HUAWEI_Mobile
connection = at19200
synchronizetime = yes
gammucoding = utf8
#logformat = textall
# SMSD configuration, see gammu-smsdrc(5)
[smsd]
service = files
logfile = /tmp/smsd.log
DeliveryReport = log
# Increase for debugging information
debuglevel = 0
CommTimeout = 3
PIN = 0000
#CheckSecurity = 0
# Soft reset every hour
ResetFrequency = 3600
# Disable (0), Enable HardReset freq
HardResetFrequency = 0
# Paths where messages are stored
inboxpath = /var/spool/gammu/inbox/
outboxpath = /var/spool/gammu/outbox/
sentsmspath = /var/spool/gammu/sent/
errorsmspath = /var/spool/gammu/error/
RunOnReceive = /root/G1SMS/sms_received.sh
# HELP: https://wammu.eu/docs/manual/smsd/config.html
# ######################################################################
!CODE
Le code de Silkaj inclu a été modifié pour accéder aux données brutes (chercher "# G1SMS::")
https://git.duniter.org/clients/python/silkaj
! Ajouter les dépendances:
apt-get install python3-pip
pip3 install setuptools
pip3 install -r requirements.txt
!LOCALISATION
G1SMS est configuré pour les téléphones français: COUNTRY="+33"
Traduire et changer ce code dans init.sh pour un autre pays!!
!!! Modifier dans init.sh le facteur en cours (G1/DU): DUFACTOR=10.04 !!!
* Mettre vos clefs Provider de service G1SMS dans les fichiers g1sms.priv.key et g1sms.pub.key
# 1 DU = 100 LOVE
# 1 LOVE = 1 CentiDU = 1/DUFACTOR G1
!TODO
* https://cesium.madeinzion.org/api/#/v1/payment/SonqoZEfZXHDBxi4KxdqVKZVygxVFTtpo9ugyDDQ6w3?amount=10
* Backup Sync System & key files
* Add minimum time between Payements (for Blockchain sync)
* Check Hidden Source Phone Number
* Set maximum wallet LOVE amount and automatic transfer to other/member wallet
* Close account & Full transfer to another (phone steal or number change)
* Register as Cesium+ service provider
* Synchronise phone accounts with multiple G1SMS servers.
* ...
......@@ -22,11 +22,13 @@ for f in $(ls ./wallets/ -t); do
fi
PUBKEY=$(cat "/root/G1SMS/wallets/$PHONE/$PHONE.pub"|xargs)
AMOUNTG1=$(./silkaj/silkaj amount --auth-scrypt -salt="$PHONE" -password="$PIN")
echo "-------------------------------"
echo "$PHONE / $PUBKEY"
echo "-> $WUID ?"
echo "Solde ($PHONE) : $AMOUNTG1 G1"
if [[ "$AMOUNTG1" == "0.0" ]]; then echo "EMPTY!!!"; fi
testmin=$( echo "${AMOUNTG1} < ${LIMIT}" | bc -l )
if [[ "$testmin" -eq "1" ]]; then echo "ALERT!!!"; fi
NB=$(bc <<< "$NB + 1")
TOTALG1=$(bc -l <<< "$AMOUNTG1 + $TOTALG1")
......@@ -47,3 +49,5 @@ for f in $(ls ./wallets/ -t); do
done
echo "Nb Porte-Monnaie Libre $NB"
echo "Solde TOTAL : $TOTAL LOVE"
echo " $TOTALG1 G1"
#!/bin/bash
cd /root/
tar -cvzf g1sms-$(date +%Y-%m-%d).tar.gz ./G1SMS/
\ No newline at end of file
......@@ -20,6 +20,16 @@ chmod 700 ./wallets
}
function choose_peer (){
# TODO: Diverse Duniter access
# https://gitlab.com/zicmama/tgen
# peers.txt: the peers you want to use, one per line, you can add a # at the beginning of the line to temporarily stop using a peer,
nbpeers=`grep -c -v "#" peers.txt`
peernum=$(( $RANDOM % $nbpeers + 1 ))
peer=`grep -v "#" peers.txt|awk '{if(NR==n)print $0}' n=$peernum`
echo $peer
}
function log () {
# log ($1=text)
if [ "$DOLOG" == "YES" ]
......@@ -99,7 +109,7 @@ log "sms_INIT_ACCOUNT ($1=phone, $2=NOSMS)"
# Send first G1SMS transaction to activate account (THIRD_PARTY_MANAGER no member wallet)
# log "$MASTERKEYFILE $PUBKEY THIRD_PARTY_MANAGER:$MASTERPUB"
INIT=$(./silkaj/silkaj transaction --auth-file -file="$MASTERKEYFILE" --amount=2 --output=$PUBKEY --comment="THIRD_PARTY_MANAGER:$MASTERPUB" -y)
INIT=$(./silkaj/silkaj transaction --auth-file -file="$MASTERKEYFILE" --amount=2.01 --output=$PUBKEY --comment="THIRD_PARTY_MANAGER:$MASTERPUB" -y)
#log "Transaction1 $INIT"
DOUBLE=$(./silkaj/silkaj transaction --auth-scrypt -salt="$PHONE" -password="$PIN" --amount=1 --output=$MASTERPUB --comment="THIRD_PARTY_MANAGER:$MASTERPUB:ACK" -y)
#log "Transaction2 $DOUBLE"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment