File: setup_db.sh

package info (click to toggle)
quickfix 1.15.1%2Bdfsg-4
  • links: PTS
  • area: main
  • in suites: bookworm, bullseye
  • size: 42,080 kB
  • sloc: cpp: 631,686; python: 129,549; ruby: 106,716; xml: 43,737; ansic: 7,668; java: 1,826; cs: 816; makefile: 544; sh: 462; sql: 313
file content (38 lines) | stat: -rwxr-xr-x 1,022 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
28
29
30
31
32
33
34
35
36
37
38
#!/bin/bash -l

source $(dirname $0)/env.rc

set -ex

echo "postgres setup"
psql --version 
sudo localedef -i en_US -f UTF-8 en_US.UTF-8 
sudo service postgresql start || /bin/true
sudo service postgresql stop || /bin/true
sudo find /etc/postgresql/ -name "pg_hba.conf" -exec /usr/bin/perl -p -i -e 's/ident/trust/g' {} \;
sudo find /etc/postgresql/ -name "pg_hba.conf" -exec cat {} \; 
sudo service postgresql start

echo "mysql setup"
sudo service mysql start || /bin/true

echo "set mysql and postgres passwords"
sudo netstat -ltpn
sudo mysqladmin -u root password password || /bin/true
echo "ALTER USER postgres WITH PASSWORD 'password'" | sudo -u postgres -i psql

echo "create mysql db and tables"
pushd src/sql/mysql
  ./create.sh root password
popd

echo "create postgres db and tables"
pushd src/sql/postgresql
  mkdir -p /tmp/quickfix-postgres
  cp * /tmp/quickfix-postgres/
  sudo chown -R postgres /tmp/quickfix-postgres/
  pushd /tmp/quickfix-postgres/
     sudo -u postgres ./create.sh postgres
  popd
popd