aboutsummaryrefslogtreecommitdiff
path: root/automatisation/BDDAuto.sh
blob: 61ff956247943ade988c3f98d7dce8974e304458 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/bin/bash
#cloner dans le repertoire personnel du root
#exucuter en tant que root

cp /root/ATS-Project/web/website/init-bd.sql /tmp/table.sql #Car problème de droit root

apt install postgresql

useradd atsuser

echo atsuser:123456 | chpasswd


echo "CREATE USER atsuser WITH PASSWORD '123456'; CREATE DATABASE atsdb; GRANT ALL PRIVILEGES ON DATABASE atsdb to atsuser;" > /tmp/conf


su - postgres -c "psql -f /tmp/conf"


pushd /tmp ; su atsuser -c "psql -d atsdb -U atsuser -f /tmp/table.sql" ; popd