blob: 2dcb4f2a7528c551db771c871f5e11867faef82d (
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/www/html/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
|