|
Apache/2.2.15 (CentOS) Linux obd60-6c49958d75-2q7cw 5.4.0-174-generic #193-Ubuntu SMP Thu Mar 7 14:29:28 UTC 2024 x86_64 uid=48(apache) gid=48(apache) groups=48(apache) server ip : 172.67.192.52 | your ip : 10.244.126.0 safemode OFF > / config / |
| Filename | /config/bootstrap.sh |
| Size | 1.35 kb |
| Permission | rwxr-xr-x |
| Owner | apache |
| Create time | 26-May-2024 11:06 |
| Last modified | 09-May-2024 14:38 |
| Last accessed | 09-May-2024 14:38 |
| Actions | edit | rename | delete | download (gzip) |
| View | text | code | image |
#!/usr/bin/env bash
set -e
set -u
# Supervisord default params
SUPERVISOR_PARAMS='-c /etc/supervisord.conf'
# Create directories for supervisor's UNIX socket and logs (which might be missing
# as container might start with /data mounted from another data-container).
mkdir -p /data/conf /data/run /data/logs
chmod 711 /data/conf /data/run /data/logs
if [ "$(ls /config/init/)" ]; then
for init in /config/init/*.sh; do
. $init
done
fi
# We have TTY, so probably an interactive container...
if test -t 0; then
# Run supervisord detached...
supervisord $SUPERVISOR_PARAMS
# Some command(s) has been passed to container? Execute them and exit.
# No commands provided? Run bash.
if [[ $@ ]]; then
eval $@
else
export PS1='[\u@\h : \w]\$ '
/bin/bash
fi
# Detached mode? Run supervisord in foreground, which will stay until container is stopped.
else
# If some extra params were passed, execute them before.
# @TODO It is a bit confusing that the passed command runs *before* supervisord,
# while in interactive mode they run *after* supervisor.
# Not sure about that, but maybe when any command is passed to container,
# it should be executed *always* after supervisord? And when the command ends,
# container exits as well.
if [[ $@ ]]; then
eval $@
fi
supervisord -n $SUPERVISOR_PARAMS
fi
set -e
set -u
# Supervisord default params
SUPERVISOR_PARAMS='-c /etc/supervisord.conf'
# Create directories for supervisor's UNIX socket and logs (which might be missing
# as container might start with /data mounted from another data-container).
mkdir -p /data/conf /data/run /data/logs
chmod 711 /data/conf /data/run /data/logs
if [ "$(ls /config/init/)" ]; then
for init in /config/init/*.sh; do
. $init
done
fi
# We have TTY, so probably an interactive container...
if test -t 0; then
# Run supervisord detached...
supervisord $SUPERVISOR_PARAMS
# Some command(s) has been passed to container? Execute them and exit.
# No commands provided? Run bash.
if [[ $@ ]]; then
eval $@
else
export PS1='[\u@\h : \w]\$ '
/bin/bash
fi
# Detached mode? Run supervisord in foreground, which will stay until container is stopped.
else
# If some extra params were passed, execute them before.
# @TODO It is a bit confusing that the passed command runs *before* supervisord,
# while in interactive mode they run *after* supervisor.
# Not sure about that, but maybe when any command is passed to container,
# it should be executed *always* after supervisord? And when the command ends,
# container exits as well.
if [[ $@ ]]; then
eval $@
fi
supervisord -n $SUPERVISOR_PARAMS
fi