Determine our full path and use that instead of /bin/zsh

Signed-off-by: fbt <fbt@fleshless.org>
This commit is contained in:
Jack L. Frost 2017-12-14 07:07:48 +03:00
parent 32b26b5783
commit 784f4eee49

17
ssm
View File

@ -136,8 +136,8 @@ depend() {
declare s
for s in "$@"; do
if ! "$0" "$s" qstatus; then
nullexec "$0" "$s" start || {
if ! "$_self" "$s" qstatus; then
nullexec "$_self" "$s" start || {
failed_deps+=( "$s" )
return 1
}
@ -178,7 +178,7 @@ depend_ready() {
depend "$@" || return 1
for s in "$@"; do
"$0" "$s" wait_ready || {
"$_self" "$s" wait_ready || {
failed_deps+=( "$s" )
return 1
}
@ -314,8 +314,8 @@ start() { super_start; }
stop() { super_stop; }
reload() { super_reload; }
restart() {
"$0" "$service_name" stop
"$0" "$service_name" start
"$_self" "$service_name" stop
"$_self" "$service_name" start
}
logs() { ${PAGER:-less} "$service_logfile"; }
@ -337,6 +337,12 @@ ready() { :; }
# Code
main() {
# Figure out our full path
case "$0" in
(/*) _self=$0;;
(*) _self="$PWD/$0";;
esac
# Needs to be global
declare -g service_pid
@ -447,6 +453,7 @@ main() {
default service_ready_flag "$rundir/$service_name.ready"
default service_enabled_flag "$rundir/$service_name.enabled"
default service_stopped_flag "$rundir/$service_name.stopped"
default service_workdir '/'
default service_stop_timeout 30
default service_ready_timeout 15
default service_stop_signal 15