aboutsummaryrefslogtreecommitdiff
path: root/automatisation/BDDAuto.sh
diff options
context:
space:
mode:
Diffstat (limited to 'automatisation/BDDAuto.sh')
-rwxr-xr-xautomatisation/BDDAuto.sh17
1 files changed, 17 insertions, 0 deletions
diff --git a/automatisation/BDDAuto.sh b/automatisation/BDDAuto.sh
new file mode 100755
index 0000000..3ec2490
--- /dev/null
+++ b/automatisation/BDDAuto.sh
@@ -0,0 +1,17 @@
+#!/bin/bash
+
+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"
+
+su - atsuser -c "psql -d atsdb -U atsuser -f /tmp/table.sql"