Working on it...

This commit is contained in:
John
2025-04-27 14:14:16 +12:00
parent 13b1327da7
commit 7a6e77420a
4 changed files with 36 additions and 13 deletions

View File

@ -15,9 +15,32 @@ SCRIPT_DIR="$(dirname "$0")"
# // |-- service name
# // |-- config <-- this is passed as argument to all scripts
# // |-- service.env
# // |-- (user config files)
# // |-- template
# // |-- (script files)
# // |-- example
# // |-- service.env
# // |-- (other config files for specific server&service)
function run_command() {
local service_path=$1
local command=$2
# check if the command is a file
if [ ! -f "${service_path}/template/${command}.sh" ]; then
return;
fi
# run the command in a subshell to prevent environment changes
(
source "${service_path}/config/service.env"
# SERVER is correct
export CONFIG_PATH="${service_path}/config"
# update the SERVICE variable
export SERVICE="${SERVICE_NAME}"
bash "${service_path}/template/${command}.sh" 2>&1
)
}
# Get all services on the server
SERVICES_PATH="${SCRIPT_DIR}/../../"