aboutsummaryrefslogtreecommitdiffstats
path: root/start-local-db.sh
diff options
context:
space:
mode:
authorSebastien Castiel <sebastien@castiel.me>2023-12-05 17:39:05 -0500
committerSebastien Castiel <sebastien@castiel.me>2023-12-05 17:39:05 -0500
commited55c696cd083bfaa5429082a9c5edd4ebde0cd8 (patch)
tree9f387881f85716bcb4a05d6fce13bfe59fbc9c17 /start-local-db.sh
parent1fd6e48807d455f66d9cd79db64cbf9e9f947c6c (diff)
First version
Diffstat (limited to 'start-local-db.sh')
-rwxr-xr-xstart-local-db.sh11
1 files changed, 11 insertions, 0 deletions
diff --git a/start-local-db.sh b/start-local-db.sh
new file mode 100755
index 0000000..c97173d
--- /dev/null
+++ b/start-local-db.sh
@@ -0,0 +1,11 @@
+result=$(docker ps | grep postgres)
+if [ $? -eq 0 ];
+then
+ echo "postgres is already running, doing nothing"
+else
+ echo "postgres is not running, starting it"
+ docker rm postgres --force
+ mkdir -p postgres-data
+ docker run --name postgres -d -p 5432:5432 -e POSTGRES_PASSWORD=1234 -v ./postgres-data:/var/lib/postgresql/data postgres
+ sleep 5 # Wait for postgres to start
+fi