Working on it...
This commit is contained in:
@ -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}/../../"
|
||||
|
Reference in New Issue
Block a user