taler-deployment

Deployment scripts and configuration files
Log | Files | Refs | README

list-incoming.sh (775B)


      1 #!/usr/bin/env bash
      2 
      3 # This file is in the public domain.
      4 
      5 # Script for basic diagnostics of a Taler regio deployment.
      6 # @author Florian Dold <dold@taler.net>
      7 
      8 if [ "$(id -u)" -ne 0 ]; then
      9   echo "FATAL: Please run as root." >&2
     10   exit 1
     11 fi
     12 
     13 exchange_db=$(taler-config -s exchangedb-postgres -o config)
     14 
     15 # runsql db RESNAME < query
     16 function runsql() {
     17   local sql
     18   read -r -d '' sql
     19   res=$(cd / && sudo -u postgres psql "$1" -t --csv -c "$sql")
     20   printf -v "$2" '%s' "$res"
     21 }
     22 
     23 runsql "$exchange_db" reserves_in <<EOF
     24 select reserve_pub from exchange.reserves_in;
     25 EOF
     26 
     27 mapfile -t lines <<<$reserves_in
     28 
     29 for line in "${lines[@]}"; do
     30   python3 -c "import binascii; import sys; sys.stdout.buffer.write(binascii.a2b_hex(sys.argv[1][2:]))" "$line" | gnunet-base32
     31   echo
     32 done
     33