Spotter-VM/postgres/etc/init.d/postgres

24 lines
394 B
Plaintext
Executable File

#!/sbin/openrc-run
description="Postgres docker container"
depend() {
need docker
}
start() {
/usr/bin/docker run -d --rm \
--name postgres \
-h postgres \
-v /srv/postgres/data:/var/lib/postgresql \
postgres
}
start_post() {
timeout -t 3 docker exec postgres sh -c 'until [ -e /var/run/postgresql/.s.PGSQL.5432 ]; do usleep 50000; done'
}
stop() {
/usr/bin/docker stop postgres
}