some path changes
Signed-off-by: fbt <fbt@fleshless.org>
This commit is contained in:
parent
acb168f880
commit
de5f640323
21
ssm
21
ssm
|
@ -307,19 +307,30 @@ main() {
|
||||||
mkdir -p "$d" || die 3 "Failed to create runtime dir: $d"
|
mkdir -p "$d" || die 3 "Failed to create runtime dir: $d"
|
||||||
done
|
done
|
||||||
|
|
||||||
# service_name is just $1
|
# If $1 is a full path, source it.
|
||||||
service_name=$1
|
# If not, search for it in the service dir.
|
||||||
|
if [[ $1 == /* ]]; then
|
||||||
|
service_config=$1
|
||||||
|
else
|
||||||
|
service_config="$cfgdir/init.d/$1"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Die if there is no such file
|
||||||
|
[[ -f "$service_config" ]] || die "No such file: $service_config"
|
||||||
|
|
||||||
|
# Service name is the basename
|
||||||
|
service_name="${1##*/}"
|
||||||
|
|
||||||
# Semi-hardcoded stuff
|
# Semi-hardcoded stuff
|
||||||
svc_pidfile="$rundir/$service_name.pid"
|
svc_pidfile="$rundir/$service_name.pid"
|
||||||
|
|
||||||
# Get the service defaults
|
# Get the service defaults
|
||||||
[[ -f "$cfgdir/conf.d/$1" ]] && {
|
[[ -f "$cfgdir/conf.d/$service_name" ]] && {
|
||||||
source "$cfgdir/conf.d/$1" || die 5 "Failed to read service defaults: $cfgdir/conf.d/$1"
|
source "$cfgdir/conf.d/$service_name" || die 5 "Failed to read service defaults: $cfgdir/conf.d/$service_name"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Get the service config
|
# Get the service config
|
||||||
source "$cfgdir/init.d/$1" || die 7 "Failed to read the service config: $cfgdir/init.d/$1"
|
source "$service_config" || die 7 "Failed to read the service config: $cfgdir/init.d/$service_name"
|
||||||
|
|
||||||
# Legacy
|
# Legacy
|
||||||
[[ "$service_args" ]] && service_command=( "${service_command[@]}" "${service_args[@]}" )
|
[[ "$service_args" ]] && service_command=( "${service_command[@]}" "${service_args[@]}" )
|
||||||
|
|
Loading…
Reference in New Issue
Block a user