38 lines
995 B
Bash
38 lines
995 B
Bash
#!/bin/bash
|
|
echo "---Checking for optional scripts---"
|
|
cp -f /opt/custom/user.sh /opt/scripts/start-user.sh > /dev/null 2>&1 ||:
|
|
cp -f /opt/scripts/user.sh /opt/scripts/start-user.sh > /dev/null 2>&1 ||:
|
|
|
|
if [ -f /opt/scripts/start-user.sh ]; then
|
|
echo "---Found optional script, executing---"
|
|
chmod -f +x /opt/scripts/start-user.sh ||:
|
|
/opt/scripts/start-user.sh || echo "---Optional Script has thrown an Error---"
|
|
else
|
|
echo "---No optional script found, continuing---"
|
|
fi
|
|
|
|
echo "---Taking ownership of data...---"
|
|
chown -R root:${GID} /opt/scripts
|
|
chmod -R 750 /opt/scripts
|
|
chown -R ${UID}:${GID} ${DATA_DIR}
|
|
chmod -R ${DATA_PERM} ${DATA_DIR}
|
|
|
|
echo "---Starting...---"
|
|
term_handler() {
|
|
kill -SIGINT "$killpid"
|
|
wait "$killpid" -f 2>/dev/null
|
|
exit 143;
|
|
}
|
|
|
|
if [ ! -z "${CONNECTED_CONTAINERS}" ]; then
|
|
/opt/scripts/start-connected-containers.sh &
|
|
fi
|
|
|
|
trap 'kill ${!}; term_handler' SIGTERM
|
|
/opt/scripts/start-server.sh &
|
|
killpid="$!"
|
|
while true
|
|
do
|
|
wait $killpid
|
|
exit 0;
|
|
done |