File: connect

package info (click to toggle)
pgagroal 2.0.0-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 5,384 kB
  • sloc: ansic: 39,090; sh: 684; python: 272; makefile: 36; sql: 13
file content (27 lines) | stat: -rwxr-xr-x 555 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/bin/sh

set -eux

bailout () {
  if test -d /run/systemd/system; then
    systemctl stop pgagroal pgagroal.socket
  else
    pkill pgagroal
  fi
}
trap bailout EXIT

service postgresql stop
if test -d /run/systemd/system; then
  systemctl start pgagroal.socket
else
  su -c 'pgagroal' postgres &
fi

pg_virtualenv -o'port=5432' <<EOF
  set -eux
  PW=agroalpass

  su -c "( echo \$PW; echo \$PW ) | createuser --pwprompt agroaltestuser" postgres
  PGPASSWORD=\$PW psql -h /run/postgresql -p 2345 -U agroaltestuser -c 'select 6*7' postgres | grep 42
EOF