-
-
Notifications
You must be signed in to change notification settings - Fork 73
Expand file tree
/
Copy pathrun
More file actions
executable file
·22 lines (20 loc) · 759 Bytes
/
run
File metadata and controls
executable file
·22 lines (20 loc) · 759 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/usr/bin/with-contenv bash
# shellcheck shell=bash
# Directories
SCRIPTS_DIR="/custom-cont-init.d"
# Make sure custom init directory exists and has files in it
if [[ -e "${SCRIPTS_DIR}" ]] && [[ -n "$(/bin/ls -A ${SCRIPTS_DIR} 2>/dev/null)" ]]; then
echo "[custom-init] Files found, executing"
for SCRIPT in "${SCRIPTS_DIR}"/*; do
NAME="$(basename "${SCRIPT}")"
if [[ -x "${SCRIPT}" ]]; then
echo "[custom-init] ${NAME}: executing..."
/bin/bash "${SCRIPT}"
echo "[custom-init] ${NAME}: exited $?"
elif [[ ! -x "${SCRIPT}" ]]; then
echo "[custom-init] ${NAME}: is not an executable file"
fi
done
else
echo "[custom-init] No custom files found, skipping..."
fi