Commit 7f746f93 authored by Boxiang Sun's avatar Boxiang Sun

peertube: backup fixup

parent b8852c35
......@@ -54,4 +54,4 @@ md5sum = 58d1a4fe246169dea94d7d243b4bac9e
[template-peertube-restore-script]
filename = template-peertube-restore.sh.in
md5sum = 959ed92e4b762127ad0c9955ac21d7b5
md5sum = 0b3206237adec20cbdb379d3766e4333
......@@ -29,6 +29,32 @@ find "$${postgresql:pgdata-directory}" -mindepth 1 -delete
# 3.
echo "Starting postgresql..."
die() {
echo "$*" 1>&2
exit 1
}
# run psql on gitlab db
psql() {
$${postgresql:bin}/psql \
-h $${postgresql:pgdata-directory} \
-U $${postgresql:superuser} \
-d $${postgresql:dbname} \
"$@"
}
# initial db setup
# ( first quering PG several times waiting a bit till postgresql is started and ready )
tpgwait=5
while true; do
pgtables="$(psql -c '\d' 2>&1)" && break
tpgwait=$(( $tpgwait - 1 ))
test $tpgwait = 0 && die "pg query problem"
echo "I: PostgreSQL is not ready (yet ?); will retry $tpgwait times..." 1>&2
sleep 1
done
echo "I: PostgreSQL ready." 1>&2
$${postgresql:bin}/postgres -D $${postgresql:pgdata-directory}
sleep 30
# If mysql has stopped, abort
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment