sysmgr

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

commit a989752c5a2a5f37bd8da84529c903062a9a7c77
parent 268a39436c51e9148563293f7dee8251c3eb4cfb
Author: Cem Keylan <cem@ckyln.com>
Date:   Mon, 13 Apr 2020 14:29:32 +0300

sysmgr: standardize writing behaviour

Diffstat:
Msysmgr | 11+++++------
1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/sysmgr b/sysmgr @@ -111,7 +111,7 @@ redirectsignal() { # cleaned up. sig="$1" - printf '%s\n' "${sig:-15}" > "${RUNDIR:?}/${service##*/}/lock" + log "${sig:-15}" > "${RUNDIR:?}/${service##*/}/lock" kill "-${sig:-15}" "$svpid" 2>/dev/null } @@ -128,7 +128,7 @@ fn_sysmgr() { mkdir -p "$RUNDIR" || die # Add pid to $RUNDIR before starting loops - printf '%s\n' "$$" > "$RUNDIR/pid" + log "$$" > "$RUNDIR/pid" # We redirect signals to the 'term' function so that # we send kill signals to all sysmgr processes. @@ -173,8 +173,8 @@ fn_runsyssv() { # exit with code 0 "$service" & svpid="$!" - printf '%s\n' "$svpid" > "$RUNDIR/${service##*/}/pid" - printf '%s\n' "$$" > "$RUNDIR/${service##*/}/syspid" + log "$svpid" > "$RUNDIR/${service##*/}/pid" + log "$$" > "$RUNDIR/${service##*/}/syspid" for sig in INT HUP QUIT ABRT TERM ; do # We want to trap every signal with their own @@ -237,8 +237,7 @@ main() { sysmgr) fn_sysmgr "$@" ;; runsyssv) fn_runsyssv "$@" ;; svctl) fn_svctl "$@" ;; - *) printf '%s is not a function\n' "${0##*/}" ; exit 1 ;; - esac + *) out "${0##*/} is not a function" ; exit 1 ; esac } main "$@"