From 506db18260baefceded116bdfc6934eea0284428 Mon Sep 17 00:00:00 2001 From: ChatChimi Date: Sat, 28 Mar 2020 16:18:39 +0100 Subject: script autoBdd --- automatisation/BDDAuto.sh | 17 +++++++++++++++++ automatisation/txt | 0 2 files changed, 17 insertions(+) create mode 100755 automatisation/BDDAuto.sh delete mode 100644 automatisation/txt (limited to 'automatisation') 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" diff --git a/automatisation/txt b/automatisation/txt deleted file mode 100644 index e69de29..0000000 -- cgit v1.2.3