🗃️ rootfs: shield internal entrypoint PID files from /run/*.pid sweeps 🗃️

Update the embedded entrypoint copies in rootfs/ to match the
upstream template change. Internal state files renamed to dotfiles
so they're not matched by `/run/*.pid` cleanup globs:
- /run/init.d/entrypoint.pid -> /run/.entrypoint.pid
- /run/no_exit.pid -> /run/.no_exit.pid
- /run/backup.pid -> /run/.backup.pid
- /run/__start_init_scripts.pid -> /run/.start_init_scripts.pid
Per-service PIDs in /run/init.d/ are unchanged.

Dockerfile
.env.scripts
rootfs/usr/local/bin/copy
rootfs/usr/local/bin/entrypoint.sh
rootfs/usr/local/bin/healthcheck
rootfs/usr/local/bin/symlink
rootfs/usr/local/etc/docker/functions/entrypoint.sh
rootfs/usr/local/etc/docker/init.d/00-go.sh
rootfs/usr/local/share/template-files/config/env/default.sample
rootfs/usr/local/share/template-files/config/env/examples/zz-entrypoint.sh
This commit is contained in:
2026-05-05 19:13:54 -04:00
parent 90c9d73695
commit bbc662fee9
10 changed files with 418 additions and 15 deletions
+1 -2
View File
@@ -77,8 +77,7 @@ DEFAULT_DATA_DIR="/usr/local/share/template-files/data"
DEFAULT_CONF_DIR="/usr/local/share/template-files/config" DEFAULT_CONF_DIR="/usr/local/share/template-files/config"
DEFAULT_TEMPLATE_DIR="/usr/local/share/template-files/defaults" DEFAULT_TEMPLATE_DIR="/usr/local/share/template-files/defaults"
# - - - - - - - - - - - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - -
ENV_PACKAGES="" ENV_PACKAGES="git make bash tini ca-certificates openssh-client curl wget tar tzdata jq build-base gcc musl-dev pkgconf openssl-dev libffi-dev zlib-dev linux-headers protobuf protobuf-dev"
# - - - - - - - - - - - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - -
# ex: ts=2 sw=2 et filetype=sh # ex: ts=2 sw=2 et filetype=sh
# - - - - - - - - - - - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - -
+1 -1
View File
@@ -54,7 +54,7 @@ ARG PHP_SERVER
ARG SHELL_OPTS ARG SHELL_OPTS
ARG PATH ARG PATH
ARG PACK_LIST="git make bash ca-certificates openssh-client curl wget tar tzdata jq build-base gcc musl-dev pkgconf openssl-dev libffi-dev zlib-dev linux-headers protobuf protobuf-dev" ARG PACK_LIST="git make bash tini ca-certificates openssh-client curl wget tar tzdata jq build-base gcc musl-dev pkgconf openssl-dev libffi-dev zlib-dev linux-headers protobuf protobuf-dev"
ENV ENV=~/.profile ENV ENV=~/.profile
ENV SHELL="/bin/sh" ENV SHELL="/bin/sh"
+78
View File
@@ -0,0 +1,78 @@
#!/usr/bin/env sh
# shellcheck shell=sh
# - - - - - - - - - - - - - - - - - - - - - - - - -
##@Version : 202605051306-git
# @@Author : Jason Hempstead
# @@Contact : jason@casjaysdev.pro
# @@License : WTFPL
# @@ReadME : copy --help
# @@Copyright : Copyright: (c) 2026 Jason Hempstead, Casjays Developments
# @@Created : Tuesday, May 05, 2026 13:06 EDT
# @@File : copy
# @@Description : copies a file and shows progress
# @@Changelog : Refactored for self-contained operation
# @@TODO : Better documentation
# @@Other :
# @@Resource :
# @@Terminal App : no
# @@sudo/root : no
# @@Template : shell/sh
# - - - - - - - - - - - - - - - - - - - - - - - - -
# shellcheck disable=SC1001,SC1003,SC2001,SC2003,SC2016,SC2031,SC2090,SC2115,SC2120,SC2155,SC2199,SC2229,SC2317,SC2329
# - - - - - - - - - - - - - - - - - - - - - - - - -
APPNAME="$(basename -- "$0" 2>/dev/null)"
# - - - - - - - - - - - - - - - - - - - - - - - - -
# colorization
if [ -n "$NO_COLOR" ]; then
__printf_color() { printf '%b' "$1\n" | tr -d '\t' | sed '/^%b$/d;s,\x1B\[ 0-9;]*[a-zA-Z],,g'; }
else
__printf_color() { { [ -z "$2" ] || DEFAULT_COLOR=$2; } && printf "%b" "$(tput setaf "$DEFAULT_COLOR" 2>/dev/null)" "$1\n" "$(tput sgr0 2>/dev/null)"; }
fi
# - - - - - - - - - - - - - - - - - - - - - - - - -
__unlink() { [ -L "$1" ] && rm -f -- "$1" >/dev/null; }
# - - - - - - - - - - - - - - - - - - - - - - - - -
# custom functions
__copy() {
exitCode=0
if [ -d "$1" ]; then
__printf_color "Copying $1/* to $2/"
__unlink "$2"
mkdir -p "$2"
for f in "$1"/* "$1"/.[!.]* "$1"/..?*; do
[ -e "$f" ] || [ -L "$f" ] || continue
base=$(basename -- "$f")
__copy "$f" "$2/$base" || exitCode=$?
done
elif [ -f "$1" ] || [ -L "$1" ]; then
__printf_color "Copying $1 to $2"
__unlink "$2"
cp -Rf "$1" "$2"
exitCode=$?
fi
return $exitCode
}
# - - - - - - - - - - - - - - - - - - - - - - - - -
# Define variables
DEFAULT_COLOR="254"
COPY_EXIT_STATUS=0
# - - - - - - - - - - - - - - - - - - - - - - - - -
# Main application
if [ $# -ne 2 ]; then
__printf_color "USAGE: $APPNAME to from" "1" >&2
COPY_EXIT_STATUS=1
elif [ ! -e "$1" ]; then
__printf_color "$1 does not exist" >&2
COPY_EXIT_STATUS=2
else
__printf_color "Copying $1 to $2" "4"
__copy "$1" "$2" >/dev/null
COPY_EXIT_STATUS=$?
fi
# - - - - - - - - - - - - - - - - - - - - - - - - -
# End application
# - - - - - - - - - - - - - - - - - - - - - - - - -
# lets exit with code
# - - - - - - - - - - - - - - - - - - - - - - - - -
exit $COPY_EXIT_STATUS
# - - - - - - - - - - - - - - - - - - - - - - - - -
# ex: ts=2 sw=2 et filetype=sh
+2 -2
View File
@@ -451,12 +451,12 @@ if [ -f "$ENTRYPOINT_PID_FILE" ]; then
# PID file exists but process is dead - this is a restart # PID file exists but process is dead - this is a restart
START_SERVICES="yes" START_SERVICES="yes"
# Clean any stale PID files on restart # Clean any stale PID files on restart
rm -f /run/__start_init_scripts.pid /run/init.d/*.pid /run/*.pid 2>/dev/null || true rm -f /run/.start_init_scripts.pid /run/init.d/*.pid /run/*.pid 2>/dev/null || true
fi fi
else else
START_SERVICES=yes START_SERVICES=yes
# Clean any stale PID files on first run # Clean any stale PID files on first run
rm -f /run/__start_init_scripts.pid /run/init.d/*.pid /run/*.pid 2>/dev/null || true rm -f /run/.start_init_scripts.pid /run/init.d/*.pid /run/*.pid 2>/dev/null || true
fi fi
# - - - - - - - - - - - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - -
[ "$ENTRYPOINT_MESSAGE" = "yes" ] && __printf_space "40" "The containers ip address is:" "$CONTAINER_IP4_ADDRESS" [ "$ENTRYPOINT_MESSAGE" = "yes" ] && __printf_space "40" "The containers ip address is:" "$CONTAINER_IP4_ADDRESS"
+249
View File
@@ -0,0 +1,249 @@
#!/usr/bin/env sh
# shellcheck shell=sh
# - - - - - - - - - - - - - - - - - - - - - - - - -
##@Version : 202605051654-git
# @@Author : Jason Hempstead
# @@Contact : jason@casjaysdev.pro
# @@License : WTFPL
# @@ReadME : healthcheck --help
# @@Copyright : Copyright: (c) 2026 Jason Hempstead, Casjays Developments
# @@Created : Tuesday, May 05, 2026 16:54 EDT
# @@File : healthcheck
# @@Description : Docker container healthcheck — HTTP/TCP/process/file checks
# @@Changelog : Rewrote as a real Docker HEALTHCHECK probe
# @@TODO : Better documentation
# @@Other :
# @@Resource :
# @@Terminal App : no
# @@sudo/root : no
# @@Template : shell/sh
# - - - - - - - - - - - - - - - - - - - - - - - - -
# shellcheck disable=SC1001,SC1003,SC2001,SC2003,SC2016,SC2031,SC2090,SC2115,SC2120,SC2155,SC2199,SC2229,SC2317,SC2329
# - - - - - - - - - - - - - - - - - - - - - - - - -
APPNAME="$(basename -- "$0" 2>/dev/null)"
VERSION="202605051654-git"
# - - - - - - - - - - - - - - - - - - - - - - - - -
# Defaults (env vars override built-ins, CLI flags override env vars)
HEALTHCHECK_URL="${HEALTHCHECK_URL:-}"
HEALTHCHECK_HTTP_STATUS="${HEALTHCHECK_HTTP_STATUS:-2,3}"
HEALTHCHECK_HOST="${HEALTHCHECK_HOST:-127.0.0.1}"
HEALTHCHECK_PORT="${HEALTHCHECK_PORT:-}"
HEALTHCHECK_PROCESS="${HEALTHCHECK_PROCESS:-}"
HEALTHCHECK_FILE="${HEALTHCHECK_FILE:-}"
HEALTHCHECK_FILE_MAX_AGE="${HEALTHCHECK_FILE_MAX_AGE:-}"
HEALTHCHECK_TIMEOUT="${HEALTHCHECK_TIMEOUT:-5}"
HEALTHCHECK_VERBOSE="${HEALTHCHECK_VERBOSE:-}"
# - - - - - - - - - - - - - - - - - - - - - - - - -
__cmd_exists() { command -v "$1" >/dev/null 2>&1; }
__log() { [ -n "$HEALTHCHECK_VERBOSE" ] && printf '%s\n' "$*" >&2; return 0; }
__fail() { printf 'UNHEALTHY: %s\n' "$*" >&2; exit 1; }
# - - - - - - - - - - - - - - - - - - - - - - - - -
__usage() {
cat <<EOF
$APPNAME $VERSION — Docker container healthcheck
Usage: $APPNAME [options]
At least one check must be configured (via env var or flag), or the script
exits 1. All configured checks must pass for the container to be healthy.
Options:
--url LIST HTTP(S) URL(s) to GET, comma-separated; ALL must
return an accepted status
(e.g. "http://localhost/health,http://localhost/ready")
--status PREFIXES Accepted status code prefixes, comma-separated
(default: "2,3" — any 2xx or 3xx; e.g. "200,204,301")
--host HOST Host for TCP port check (default: 127.0.0.1)
--port LIST TCP port(s) that must be accepting connections,
comma-separated; ALL must be reachable
(e.g. "80,443,3306")
--process LIST Process name(s) that must be running (matches the
executable name via pgrep). Comma-separated for
multiple — ALL must be present
(e.g. "tini,nginx,postfix,mariadb")
--file LIST File path(s) that must exist, comma-separated; ALL
must exist (and pass --file-max-age, if set)
--file-max-age SECONDS Each file's mtime must be within this many seconds
--timeout SECONDS Network check timeout (default: 5)
-v, --verbose Print check progress to stderr
-h, --help Show this help and exit 0
Environment variables (overridden by flags):
HEALTHCHECK_URL, HEALTHCHECK_HTTP_STATUS, HEALTHCHECK_HOST,
HEALTHCHECK_PORT, HEALTHCHECK_PROCESS, HEALTHCHECK_FILE,
HEALTHCHECK_FILE_MAX_AGE, HEALTHCHECK_TIMEOUT, HEALTHCHECK_VERBOSE
Exit codes:
0 all configured checks passed
1 at least one check failed, or no checks were configured
EOF
}
# - - - - - - - - - - - - - - - - - - - - - - - - -
# Parse CLI flags (override env vars)
while [ $# -gt 0 ]; do
case "$1" in
--url) HEALTHCHECK_URL="$2"; shift 2 ;;
--url=*) HEALTHCHECK_URL="${1#*=}"; shift ;;
--status) HEALTHCHECK_HTTP_STATUS="$2"; shift 2 ;;
--status=*) HEALTHCHECK_HTTP_STATUS="${1#*=}"; shift ;;
--host) HEALTHCHECK_HOST="$2"; shift 2 ;;
--host=*) HEALTHCHECK_HOST="${1#*=}"; shift ;;
--port) HEALTHCHECK_PORT="$2"; shift 2 ;;
--port=*) HEALTHCHECK_PORT="${1#*=}"; shift ;;
--process) HEALTHCHECK_PROCESS="$2"; shift 2 ;;
--process=*) HEALTHCHECK_PROCESS="${1#*=}"; shift ;;
--file) HEALTHCHECK_FILE="$2"; shift 2 ;;
--file=*) HEALTHCHECK_FILE="${1#*=}"; shift ;;
--file-max-age) HEALTHCHECK_FILE_MAX_AGE="$2"; shift 2 ;;
--file-max-age=*) HEALTHCHECK_FILE_MAX_AGE="${1#*=}"; shift ;;
--timeout) HEALTHCHECK_TIMEOUT="$2"; shift 2 ;;
--timeout=*) HEALTHCHECK_TIMEOUT="${1#*=}"; shift ;;
-v|--verbose) HEALTHCHECK_VERBOSE=1; shift ;;
-h|--help) __usage; exit 0 ;;
--) shift; break ;;
-*) printf 'Unknown option: %s\n' "$1" >&2; __usage >&2; exit 1 ;;
*) printf 'Unexpected argument: %s\n' "$1" >&2; exit 1 ;;
esac
done
# - - - - - - - - - - - - - - - - - - - - - - - - -
# Individual checks — each prints why it failed and exits 1 on failure
__trim() { printf '%s' "$1" | sed 's/^[[:space:]]*//;s/[[:space:]]*$//'; }
__check_one_http() {
url="$1"; accepted="$2"; timeout="$3"
if __cmd_exists curl; then
code="$(curl -ksSL -o /dev/null -w '%{http_code}' --max-time "$timeout" "$url" 2>/dev/null)" \
|| __fail "HTTP request to $url failed (curl error)"
elif __cmd_exists wget; then
code="$(wget -q -S --spider --timeout="$timeout" --tries=1 "$url" 2>&1 \
| awk '/^ HTTP\// {c=$2} END {print c+0}')"
[ "$code" -gt 0 ] 2>/dev/null || __fail "HTTP request to $url failed (wget error)"
else
__fail "HTTP check requires curl or wget"
fi
IFS=','
for prefix in $accepted; do
case "$code" in
"$prefix"*) unset IFS; __log "HTTP ok: $url -> $code"; return 0 ;;
esac
done
unset IFS
__fail "HTTP $url returned $code (expected prefix in: $accepted)"
}
__check_http() {
urls="$1"; accepted="$2"; timeout="$3"
__log "HTTP: urls=$urls (timeout=${timeout}s, accept=${accepted})"
IFS=','
for u in $urls; do
unset IFS
u="$(__trim "$u")"
[ -n "$u" ] || { IFS=','; continue; }
__check_one_http "$u" "$accepted" "$timeout"
IFS=','
done
unset IFS
return 0
}
__check_one_tcp() {
host="$1"; port="$2"; timeout="$3"
if __cmd_exists nc; then
nc -z -w "$timeout" "$host" "$port" >/dev/null 2>&1 && { __log "TCP ok: $host:$port"; return 0; }
fi
if __cmd_exists ncat; then
ncat -z -w "${timeout}s" "$host" "$port" >/dev/null 2>&1 && { __log "TCP ok (ncat): $host:$port"; return 0; }
fi
# Last resort: bash /dev/tcp (only if bash is available; sh-only systems skip)
if __cmd_exists bash; then
bash -c "exec 3<>/dev/tcp/$host/$port" >/dev/null 2>&1 && { __log "TCP ok (bash): $host:$port"; return 0; }
fi
return 1
}
__check_tcp() {
host="$1"; ports="$2"; timeout="$3"
__log "TCP: host=$host ports=$ports (timeout=${timeout}s)"
IFS=','
for p in $ports; do
unset IFS
p="$(__trim "$p")"
[ -n "$p" ] || { IFS=','; continue; }
__check_one_tcp "$host" "$p" "$timeout" || __fail "TCP $host:$p not reachable"
IFS=','
done
unset IFS
return 0
}
__check_one_process() {
pattern="$1"
if __cmd_exists pgrep; then
# Match against process name (not full cmdline) so our own argv doesn't self-match
pgrep -- "$pattern" >/dev/null 2>&1 && return 0
else
# Portable fallback: ps -o comm= prints just the command name
ps -e -o comm= 2>/dev/null | grep -v -e "^grep$" -e "^$APPNAME$" | grep -q -- "$pattern" && return 0
fi
return 1
}
__check_process() {
patterns="$1"
__log "Process: patterns=$patterns"
IFS=','
for p in $patterns; do
unset IFS
p="$(__trim "$p")"
[ -n "$p" ] || { IFS=','; continue; }
__check_one_process "$p" || __fail "Process not running: $p"
__log "Process ok: $p"
IFS=','
done
unset IFS
return 0
}
__check_one_file() {
path="$1"; max_age="$2"
[ -e "$path" ] || __fail "File not found: $path"
if [ -n "$max_age" ]; then
now="$(date +%s)"
mtime="$(stat -c %Y "$path" 2>/dev/null || stat -f %m "$path" 2>/dev/null \
|| perl -e 'print((stat(shift))[9])' "$path" 2>/dev/null)"
[ -n "$mtime" ] || __fail "Cannot determine mtime of $path"
age=$(( now - mtime ))
[ "$age" -le "$max_age" ] || __fail "File $path is stale (age=${age}s, max=${max_age}s)"
fi
__log "File ok: $path"
return 0
}
__check_file() {
paths="$1"; max_age="$2"
__log "File: paths=$paths max_age=${max_age:-none}"
IFS=','
for f in $paths; do
unset IFS
f="$(__trim "$f")"
[ -n "$f" ] || { IFS=','; continue; }
__check_one_file "$f" "$max_age"
IFS=','
done
unset IFS
return 0
}
# - - - - - - - - - - - - - - - - - - - - - - - - -
# Run checks
ran_any=0
[ -n "$HEALTHCHECK_URL" ] && { __check_http "$HEALTHCHECK_URL" "$HEALTHCHECK_HTTP_STATUS" "$HEALTHCHECK_TIMEOUT"; ran_any=1; }
[ -n "$HEALTHCHECK_PORT" ] && { __check_tcp "$HEALTHCHECK_HOST" "$HEALTHCHECK_PORT" "$HEALTHCHECK_TIMEOUT"; ran_any=1; }
[ -n "$HEALTHCHECK_PROCESS" ] && { __check_process "$HEALTHCHECK_PROCESS"; ran_any=1; }
[ -n "$HEALTHCHECK_FILE" ] && { __check_file "$HEALTHCHECK_FILE" "$HEALTHCHECK_FILE_MAX_AGE"; ran_any=1; }
[ "$ran_any" -eq 1 ] || __fail "no checks configured (set HEALTHCHECK_URL/PORT/PROCESS/FILE or pass --url/--port/--process/--file)"
__log "All checks passed"
exit 0
# - - - - - - - - - - - - - - - - - - - - - - - - -
# ex: ts=2 sw=2 et filetype=sh
+77
View File
@@ -0,0 +1,77 @@
#!/usr/bin/env sh
# shellcheck shell=sh
# - - - - - - - - - - - - - - - - - - - - - - - - -
##@Version : 202605051306-git
# @@Author : Jason Hempstead
# @@Contact : jason@casjaysdev.pro
# @@License : WTFPL
# @@ReadME : symlink --help
# @@Copyright : Copyright: (c) 2026 Jason Hempstead, Casjays Developments
# @@Created : Tuesday, May 05, 2026 13:06 EDT
# @@File : symlink
# @@Description :
# @@Changelog : New script
# @@TODO : Better documentation
# @@Other :
# @@Resource :
# @@Terminal App : no
# @@sudo/root : no
# @@Template : shell/sh
# - - - - - - - - - - - - - - - - - - - - - - - - -
# shellcheck disable=SC1001,SC1003,SC2001,SC2003,SC2016,SC2031,SC2090,SC2115,SC2120,SC2155,SC2199,SC2229,SC2317,SC2329
# - - - - - - - - - - - - - - - - - - - - - - - - -
APPNAME="$(basename -- "$0" 2>/dev/null)"
# - - - - - - - - - - - - - - - - - - - - - - - - -
# colorization
if [ -n "$NO_COLOR" ]; then
__printf_color() { printf '%b' "$1\n" | tr -d '\t' | sed '/^%b$/d;s,\x1B\[ 0-9;]*[a-zA-Z],,g'; }
else
__printf_color() { { [ -z "$2" ] || DEFAULT_COLOR=$2; } && printf "%b" "$(tput setaf "$DEFAULT_COLOR" 2>/dev/null)" "$1\n" "$(tput sgr0 2>/dev/null)"; }
fi
# - - - - - - - - - - - - - - - - - - - - - - - - -
__unlink() { [ -L "$1" ] && rm -f -- "$1" >/dev/null; }
# - - - - - - - - - - - - - - - - - - - - - - - - -
# custom functions
__ln_sf() {
exitCode=0
if [ -d "$1" ] && [ ! -L "$1" ]; then
__printf_color "symlinking contents of $1 into $2/" "4"
__unlink "$2"
mkdir -p "$2"
for f in "$1"/* "$1"/.[!.]* "$1"/..?*; do
[ -e "$f" ] || [ -L "$f" ] || continue
base=$(basename -- "$f")
__ln_sf "$f" "$2/$base" || exitCode=$?
done
else
__printf_color "symlinking $2 to $1" "4"
__unlink "$2"
ln -sf "$1" "$2"
exitCode=$?
fi
return $exitCode
}
# - - - - - - - - - - - - - - - - - - - - - - - - -
# Define variables
DEFAULT_COLOR="254"
SYMLINK_EXIT_STATUS=0
# - - - - - - - - - - - - - - - - - - - - - - - - -
# Main application
if [ $# -ne 2 ]; then
__printf_color "USAGE: $APPNAME from to" "2" >&2
SYMLINK_EXIT_STATUS=1
elif [ ! -e "$1" ]; then
__printf_color "$1 does not exist" >&2
SYMLINK_EXIT_STATUS=2
else
__ln_sf "$1" "$2" >/dev/null
SYMLINK_EXIT_STATUS=$?
fi
# - - - - - - - - - - - - - - - - - - - - - - - - -
# End application
# - - - - - - - - - - - - - - - - - - - - - - - - -
# lets exit with code
# - - - - - - - - - - - - - - - - - - - - - - - - -
exit $SYMLINK_EXIT_STATUS
# - - - - - - - - - - - - - - - - - - - - - - - - -
# ex: ts=2 sw=2 et filetype=sh
@@ -280,11 +280,11 @@ __no_exit() {
local failed_services="" local failed_services=""
local failure_count=0 local failure_count=0
[ -f "/run/no_exit.pid" ] && return 0 [ -f "/run/.no_exit.pid" ] && return 0
exec bash -c " exec bash -c "
trap 'echo \"Container shutdown requested\"; rm -f /run/no_exit.pid /run/*.pid; exit 0' TERM INT trap 'echo \"Container shutdown requested\"; rm -f /run/.no_exit.pid /run/*.pid; exit 0' TERM INT
echo \$\$ > /run/no_exit.pid echo \$\$ > /run/.no_exit.pid
while true; do while true; do
if [ -n \"$monitor_services\" ] && [ \"$monitor_services\" != \"tini\" ]; then if [ -n \"$monitor_services\" ] && [ \"$monitor_services\" != \"tini\" ]; then
@@ -1060,13 +1060,13 @@ __start_init_scripts() {
local retstatus="0" local retstatus="0"
local initStatus="0" local initStatus="0"
local critical_failures="0" local critical_failures="0"
local pidFile="/run/__start_init_scripts.pid" local pidFile="/run/.start_init_scripts.pid"
local init_dir="${1:-/usr/local/etc/docker/init.d}" local init_dir="${1:-/usr/local/etc/docker/init.d}"
local init_count="$(ls -A "$init_dir"/* 2>/dev/null | grep -v '\.sample' | wc -l)" local init_count="$(ls -A "$init_dir"/* 2>/dev/null | grep -v '\.sample' | wc -l)"
local exit_on_failure="${EXIT_ON_SERVICE_FAILURE:-true}" local exit_on_failure="${EXIT_ON_SERVICE_FAILURE:-true}"
# Clean stale PID files from previous runs # Clean stale PID files from previous runs
if [ ! -f "/run/__start_init_scripts.pid" ]; then if [ ! -f "/run/.start_init_scripts.pid" ]; then
echo "🧹 Cleaning stale PID files from previous container run" echo "🧹 Cleaning stale PID files from previous container run"
rm -f /run/*.pid /run/init.d/*.pid 2>/dev/null || true rm -f /run/*.pid /run/init.d/*.pid 2>/dev/null || true
fi fi
@@ -1668,7 +1668,7 @@ __backup() {
fi fi
local exitCodeP=0 local exitCodeP=0
local exitStatus=0 local exitStatus=0
local pidFile="/run/backup.pid" local pidFile="/run/.backup.pid"
local logDir="/data/log/backups" local logDir="/data/log/backups"
maxDays="${BACKUP_MAX_DAYS:-$maxDays}" maxDays="${BACKUP_MAX_DAYS:-$maxDays}"
cronTime="${BACKUP_RUN_CRON:-$cronTime}" cronTime="${BACKUP_RUN_CRON:-$cronTime}"
@@ -1748,7 +1748,7 @@ export LIGHTTPD_CONFIG_FILE="${LIGHTTPD_CONFIG_FILE:-$(__find_lighttpd_conf)}"
export MARIADB_CONFIG_FILE="${MARIADB_CONFIG_FILE:-$(__find_mysql_conf)}" export MARIADB_CONFIG_FILE="${MARIADB_CONFIG_FILE:-$(__find_mysql_conf)}"
export POSTGRES_CONFIG_FILE="${POSTGRES_CONFIG_FILE:-$(__find_pgsql_conf)}" export POSTGRES_CONFIG_FILE="${POSTGRES_CONFIG_FILE:-$(__find_pgsql_conf)}"
export MONGODB_CONFIG_FILE="${MONGODB_CONFIG_FILE:-$(__find_mongodb_conf)}" export MONGODB_CONFIG_FILE="${MONGODB_CONFIG_FILE:-$(__find_mongodb_conf)}"
export ENTRYPOINT_PID_FILE="${ENTRYPOINT_PID_FILE:-/run/init.d/entrypoint.pid}" export ENTRYPOINT_PID_FILE="${ENTRYPOINT_PID_FILE:-/run/.entrypoint.pid}"
export ENTRYPOINT_INIT_FILE="${ENTRYPOINT_INIT_FILE:-/config/.entrypoint.done}" export ENTRYPOINT_INIT_FILE="${ENTRYPOINT_INIT_FILE:-/config/.entrypoint.done}"
export ENTRYPOINT_DATA_INIT_FILE="${ENTRYPOINT_DATA_INIT_FILE:-/data/.docker_has_run}" export ENTRYPOINT_DATA_INIT_FILE="${ENTRYPOINT_DATA_INIT_FILE:-/data/.docker_has_run}"
export ENTRYPOINT_CONFIG_INIT_FILE="${ENTRYPOINT_CONFIG_INIT_FILE:-/config/.docker_has_run}" export ENTRYPOINT_CONFIG_INIT_FILE="${ENTRYPOINT_CONFIG_INIT_FILE:-/config/.docker_has_run}"
+1 -1
View File
@@ -91,7 +91,7 @@ for set_env in "/root/env.sh" "/usr/local/etc/docker/env"/*.sh "/config/env"/*.s
done done
# - - - - - - - - - - - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - -
# exit if __start_init_scripts function hasn't been Initialized # exit if __start_init_scripts function hasn't been Initialized
if [ ! -f "/run/__start_init_scripts.pid" ]; then if [ ! -f "/run/.start_init_scripts.pid" ]; then
echo "__start_init_scripts function hasn't been Initialized" >&2 echo "__start_init_scripts function hasn't been Initialized" >&2
SERVICE_IS_RUNNING="no" SERVICE_IS_RUNNING="no"
__script_exit 1 __script_exit 1
@@ -116,7 +116,7 @@ DATABASE_DIR_SUPABASE="${DATABASE_DIR_SUPABASE:-$DATABASE_BASE_DIR/supabase}"
DOCKER_HOST="unix://var/run/docker.sock" DOCKER_HOST="unix://var/run/docker.sock"
# - - - - - - - - - - - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - -
# File locations # File locations
ENTRYPOINT_PID_FILE="${ENTRYPOINT_PID_FILE:-/run/init.d/entrypoint.pid}" ENTRYPOINT_PID_FILE="${ENTRYPOINT_PID_FILE:-/run/.entrypoint.pid}"
ENTRYPOINT_INIT_FILE="${ENTRYPOINT_INIT_FILE:-/config/.entrypoint.done}" ENTRYPOINT_INIT_FILE="${ENTRYPOINT_INIT_FILE:-/config/.entrypoint.done}"
ENTRYPOINT_DATA_INIT_FILE="${ENTRYPOINT_DATA_INIT_FILE:-/data/.docker_has_run}" ENTRYPOINT_DATA_INIT_FILE="${ENTRYPOINT_DATA_INIT_FILE:-/data/.docker_has_run}"
ENTRYPOINT_CONFIG_INIT_FILE="${ENTRYPOINT_CONFIG_INIT_FILE:-/config/.docker_has_run}" ENTRYPOINT_CONFIG_INIT_FILE="${ENTRYPOINT_CONFIG_INIT_FILE:-/config/.docker_has_run}"
@@ -1,6 +1,6 @@
# - - - - - - - - - - - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - -
# File locations # File locations
ENTRYPOINT_PID_FILE="${ENTRYPOINT_PID_FILE:-/run/init.d/entrypoint.pid}" ENTRYPOINT_PID_FILE="${ENTRYPOINT_PID_FILE:-/run/.entrypoint.pid}"
ENTRYPOINT_INIT_FILE="${ENTRYPOINT_INIT_FILE:-/config/.entrypoint.done}" ENTRYPOINT_INIT_FILE="${ENTRYPOINT_INIT_FILE:-/config/.entrypoint.done}"
ENTRYPOINT_DATA_INIT_FILE="${ENTRYPOINT_DATA_INIT_FILE:-/data/.docker_has_run}" ENTRYPOINT_DATA_INIT_FILE="${ENTRYPOINT_DATA_INIT_FILE:-/data/.docker_has_run}"
ENTRYPOINT_CONFIG_INIT_FILE="${ENTRYPOINT_CONFIG_INIT_FILE:-/config/.docker_has_run}" ENTRYPOINT_CONFIG_INIT_FILE="${ENTRYPOINT_CONFIG_INIT_FILE:-/config/.docker_has_run}"