fix exit trap
This commit is contained in:
parent
20f31cdc13
commit
d82cb9435d
1 changed files with 7 additions and 7 deletions
|
@ -1,6 +1,11 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
|
function finish() {
|
||||||
|
echo "$(date) Cleaning up..."
|
||||||
|
kill "${SERVER_PID}" 2>/dev/null
|
||||||
|
rm -r "${TMP_DIR}"
|
||||||
|
}
|
||||||
echo "$(date) Syncing database..."
|
echo "$(date) Syncing database..."
|
||||||
rsync -v sdbs:/var/www/sdbs-pile/db.sqlite3 .
|
rsync -v sdbs:/var/www/sdbs-pile/db.sqlite3 .
|
||||||
echo "$(date) Syncing /docs..."
|
echo "$(date) Syncing /docs..."
|
||||||
|
@ -11,6 +16,8 @@ OUT_DIR="${TMP_DIR}/sdbs_pile"
|
||||||
mkdir -p "${OUT_DIR}"
|
mkdir -p "${OUT_DIR}"
|
||||||
echo "$(date) Will backup into ${OUT_DIR}"
|
echo "$(date) Will backup into ${OUT_DIR}"
|
||||||
|
|
||||||
|
trap finish EXIT
|
||||||
|
|
||||||
echo "$(date) Starting local pile server"
|
echo "$(date) Starting local pile server"
|
||||||
source .venv/bin/activate
|
source .venv/bin/activate
|
||||||
STATIC=1 python manage.py runserver 4123 &
|
STATIC=1 python manage.py runserver 4123 &
|
||||||
|
@ -29,10 +36,3 @@ kill "${SERVER_PID}"
|
||||||
|
|
||||||
echo "$(date) Compressing archive..."
|
echo "$(date) Compressing archive..."
|
||||||
7z a sdbs_pile__$(date "+%Y-%m-%d__%H%M%S").7z "${OUT_DIR}"
|
7z a sdbs_pile__$(date "+%Y-%m-%d__%H%M%S").7z "${OUT_DIR}"
|
||||||
|
|
||||||
function finish() {
|
|
||||||
echo "$(date) Cleaning up..."
|
|
||||||
kill "${SERVER_PID}" 2>/dev/null
|
|
||||||
rm -r "${TMP_DIR}"
|
|
||||||
}
|
|
||||||
trap finish EXIT
|
|
||||||
|
|
Loading…
Reference in a new issue