some path changes

Signed-off-by: fbt <fbt@fleshless.org>
This commit is contained in:
Jack L. Frost 2016-11-14 06:31:53 +03:00
parent acb168f880
commit de5f640323
1 changed files with 16 additions and 5 deletions

21
ssm
View File

@ -307,19 +307,30 @@ main() {
mkdir -p "$d" || die 3 "Failed to create runtime dir: $d"
done
# service_name is just $1
service_name=$1
# If $1 is a full path, source it.
# 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
svc_pidfile="$rundir/$service_name.pid"
# Get the service defaults
[[ -f "$cfgdir/conf.d/$1" ]] && {
source "$cfgdir/conf.d/$1" || die 5 "Failed to read service defaults: $cfgdir/conf.d/$1"
[[ -f "$cfgdir/conf.d/$service_name" ]] && {
source "$cfgdir/conf.d/$service_name" || die 5 "Failed to read service defaults: $cfgdir/conf.d/$service_name"
}
# 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
[[ "$service_args" ]] && service_command=( "${service_command[@]}" "${service_args[@]}" )