mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-05-01 11:19:32 -05:00
fix bug where docker-entrypoint.sh exits w/o notice
This commit fixes a nasty bug, where the docker-entrypoint.sh silently exits without any error message. The test for a lock file can fail and due to the `set -e` at the beginning of the file the bash script exists without starting the paperless application. It is fixed by moving the check for the existence of the lock file into the if statement, where the `set -e` does not trigger an exit in case the statement fails. Additionally this commit enables the script to trap exit signals and in that case deletes the lock file.
This commit is contained in:
parent
bce2d3dd22
commit
1c0801a3ec
@ -46,11 +46,10 @@ migrations() {
|
|||||||
# A simple lock file in case other containers use this startup
|
# A simple lock file in case other containers use this startup
|
||||||
LOCKFILE="/usr/src/paperless/data/db.sqlite3.migration"
|
LOCKFILE="/usr/src/paperless/data/db.sqlite3.migration"
|
||||||
|
|
||||||
set -o noclobber
|
|
||||||
# check for and create lock file in one command
|
# check for and create lock file in one command
|
||||||
(> ${LOCKFILE}) &> /dev/null
|
if (set -o noclobber; echo "$$" > "${LOCKFILE}") 2> /dev/null
|
||||||
if [ $? -eq 0 ]
|
|
||||||
then
|
then
|
||||||
|
trap 'rm -f "${LOCKFILE}"; exit $?' INT TERM EXIT
|
||||||
sudo -HEu paperless "/usr/src/paperless/src/manage.py" "migrate"
|
sudo -HEu paperless "/usr/src/paperless/src/manage.py" "migrate"
|
||||||
rm ${LOCKFILE}
|
rm ${LOCKFILE}
|
||||||
fi
|
fi
|
||||||
|
Loading…
x
Reference in New Issue
Block a user