File tree Expand file tree Collapse file tree 2 files changed +61
-0
lines changed Expand file tree Collapse file tree 2 files changed +61
-0
lines changed Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+
3+ set -e
4+ set -u
5+ set -o pipefail
6+
7+
8+ # ###########################################################
9+ # Functions
10+ # ###########################################################
11+
12+ # ##
13+ # ## Execute project-supplied scripts
14+ # ##
15+ execute_project_scripts () {
16+ local debug=" ${1} "
17+ local project
18+ local script_dir
19+ local script_name
20+
21+ for project_dir in /shared/httpd/* ; do
22+
23+ script_dir=${project_dir} /.devilbox/autostart
24+
25+ if [ -d " ${project_dir} " ] && [ -d " ${script_dir} " ]; then
26+
27+ project=$( basename " ${project_dir} " )
28+
29+ script_files=" $( find -L " ${script_dir} " -type f -iname ' *.sh' | sort -n) "
30+
31+ # loop over them line by line
32+ IFS='
33+ '
34+ for script_f in ${script_files} ; do
35+
36+ script_name=" $( basename " ${script_f} " ) "
37+
38+ log " info" " Executing project startup script: ${project} :${script_name} " " ${debug} "
39+
40+ if ! bash " ${script_f} " " ${debug} " ; then
41+ log " err" " Failed to execute script" " ${debug} "
42+ exit 1
43+ fi
44+
45+ done
46+ fi
47+ done
48+ }
49+
50+
51+ # ###########################################################
52+ # Sanity Checks
53+ # ###########################################################
54+
55+ # find, sort, and basename are already checked in ./310-custom-startup-scripts.sh
Original file line number Diff line number Diff line change @@ -185,6 +185,12 @@ execute_custom_scripts "/startup.1.d" "${DEBUG_LEVEL}"
185185execute_custom_scripts " /startup.2.d" " ${DEBUG_LEVEL} "
186186
187187
188+ # ##
189+ # ## Run project supplied scripts
190+ # ##
191+ execute_project_scripts " ${DEBUG_LEVEL} "
192+
193+
188194# ##
189195# ##
190196# ## Startup
You can’t perform that action at this time.
0 commit comments