taler-windows

Windows packaging
Log | Files | Refs

test-db.sh (682B)


      1 #!/bin/bash
      2 # test-db.sh
      3 # Usage: ./test-db.sh <POSTGRES_URL>
      4 echo "=== [DEBUG] test-db.sh called ===" | tee -a /home/taleruser/taler-installer/test-db.log
      5 echo "Received URL: $1" | tee -a /home/taleruser/taler-installer/test-db.log
      6 POSTGRES_URL="$1"
      7 
      8 echo "Testing $POSTGRES_URL" > /tmp/dbtest.log
      9 
     10 if command -v psql >/dev/null 2>&1; then
     11     if psql "$POSTGRES_URL" -c '\q' >> /tmp/dbtest.log 2>&1; then
     12         echo "OK"
     13         echo "Exit code: 0" >> /tmp/dbtest.log
     14         exit 0
     15     else
     16         echo "ERROR"
     17         echo "Exit code: 1" >> /tmp/dbtest.log
     18         exit 1
     19     fi
     20 else
     21     echo "psql command not found"
     22     echo "Exit code: 2" >> /tmp/dbtest.log
     23     exit 2
     24 fi