14
ssm
14
ssm
@@ -349,6 +349,8 @@ main() {
|
||||
logdir='/var/log/ssm'
|
||||
fi
|
||||
|
||||
service_path+=( "$cfgdir/init.d" "$rundir/services" )
|
||||
|
||||
# Load custom functions
|
||||
for f in "$cfgdir/functions"/*; do
|
||||
source "$f" || die 9 "Failed to source functions from $f"
|
||||
@@ -360,15 +362,17 @@ main() {
|
||||
done
|
||||
|
||||
# If $1 is a full path, source it.
|
||||
# If not, search for it in the service dir.
|
||||
# If not, search for it in the service path.
|
||||
if [[ $1 == /* ]]; then
|
||||
service_config=$1
|
||||
else
|
||||
service_config="$cfgdir/init.d/$1"
|
||||
for i in "${service_path[@]}"; do
|
||||
[[ -f "$i/$1" ]] && service_config="$i/$1"
|
||||
done
|
||||
fi
|
||||
|
||||
# Die if there is no such file
|
||||
[[ -f "$service_config" ]] || die "No such file: $service_config"
|
||||
[[ "$service_config" ]] || die 19 "Service not found: $1"
|
||||
|
||||
# Service name is the basename
|
||||
service_name="${1##*/}"
|
||||
@@ -387,7 +391,9 @@ main() {
|
||||
# Legacy
|
||||
[[ "$service_args" ]] && service_command=( "${service_command[@]}" "${service_args[@]}" )
|
||||
[[ "$service_respawn" == 'true' ]] && service_respawn=1
|
||||
[[ "$service_type" == 'oneshot' ]] && { service_oneshot=1; service_managed=0; }
|
||||
[[ "$service_type" == 'oneshot' ]] && service_oneshot=1
|
||||
|
||||
(( service_oneshot )) && service_managed=0
|
||||
|
||||
[[ "$service_pidfile" ]] && service_managed=0
|
||||
|
||||
|
Reference in New Issue
Block a user