sysmgr

a simplistic service supervisor (deprecated)
git clone git://git.ckyln.com/~cem/sysmgr.git
Log | Files | Refs | README | LICENSE

commit fd0bfa7a8a6ed029b930764f47e78ebfd356399e
parent 7e6521ee01d8eb53ac454ae289adc241e5c447f1
Author: Cem Keylan <cem@ckyln.com>
Date:   Tue, 25 Feb 2020 11:48:00 +0300

sysmgr: do not exit if no services can be found

Diffstat:
Msysmgr | 4++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sysmgr b/sysmgr @@ -83,7 +83,7 @@ fn_sysmgr() { # given SYSDIR exists, and has service files installed. [ "$SYSDIR" ] || die "Please specify service directory" [ -d "$SYSDIR" ] || die "$SYSDIR does not exist." - [ "$(ls -1 "$SYSDIR")" ] || die "No service file is found" + [ "$(ls -1 "$SYSDIR")" ] || error "No service file is found" mkdir -p "$RUNDIR" || die # Add pid to $RUNDIR before starting loops @@ -101,7 +101,7 @@ fn_sysmgr() { # to wait until runsyssv has finished, which is a # program that is not supposed to exit. while sleep 1 ; do - for service in "$SYSDIR"/* ; do + [ "$(ls -A "$SYSDIR" )" ] && for service in "$SYSDIR"/* ; do [ -x "$service" ] || error "$service is not an executable file" ! [ -d "$RUNDIR/${service##*/}" ] && runsyssv "$service" & done