bunkerweb/autoconf/entrypoint.sh
2021-05-26 20:50:03 +02:00

40 lines
658 B
Bash

#!/bin/bash
echo "[*] Starting autoconf ..."
# check permissions
su -s "/opt/entrypoint/permissions.sh" nginx
if [ "$?" -ne 0 ] ; then
exit 1
fi
if [ "$SWARM_MODE" = "yes" ] ; then
cp -r /opt/confs/nginx/* /etc/nginx
chown -R root:nginx /etc/nginx
chmod -R 770 /etc/nginx
fi
# trap SIGTERM and SIGINT
function trap_exit() {
echo "[*] Catched stop operation"
echo "[*] Stopping crond ..."
pkill -TERM crond
echo "[*] Stopping autoconf ..."
pkill -TERM python3
}
trap "trap_exit" TERM INT QUIT
# start cron
crond
# run autoconf app
/opt/entrypoint/app.py &
pid="$!"
# wait while app is up
wait "$pid"
# stop
echo "[*] autoconf stopped"
exit 0