sm

sysmgr implemented in C
git clone git://git.ckyln.com/sm
Log | Files | Refs | README | LICENSE

commit 57a9c70104bf6133e8a445e9a212ffa809a7ab06
parent b8691f57c8232447ef0c0c6bb906f58576e604e4
Author: Cem Keylan <cem@ckyln.com>
Date:   Sat, 10 Oct 2020 12:17:31 +0300

sysmgr: add manual pages

Diffstat:
MMakefile | 21+++++++++++++++++----
Aman/runsyssv.1 | 15+++++++++++++++
Aman/svctl.1 | 28++++++++++++++++++++++++++++
Aman/sysmgr-depends.1 | 13+++++++++++++
Aman/sysmgr.8 | 55+++++++++++++++++++++++++++++++++++++++++++++++++++++++
5 files changed, 128 insertions(+), 4 deletions(-)

diff --git a/Makefile b/Makefile @@ -18,10 +18,17 @@ LIBUTILSRC = \ BIN = \ - sysmgr \ - runsyssv \ - svctl \ - sysmgr-depends + sysmgr \ + runsyssv \ + svctl \ + sysmgr-depends + +MAN = \ + man/runsyssv.1 \ + man/svctl.1 \ + man/sysmgr-depends.1 \ + man/sysmgr.8 + SRC = ${BIN:=.c} BINOBJ = ${SRC:.c=.o} @@ -59,8 +66,14 @@ install: all mkdir -p ${DESTDIR}${BINDIR} cp ${BIN} ${DESTDIR}${BINDIR} for bin in ${BIN}; do chmod 755 ${DESTDIR}${BINDIR}/$${bin}; done + for man in ${MAN}; do \ + mkdir -p ${DESTDIR}${MANPREFIX}/man$${man##*.}; \ + cp $${man} ${DESTDIR}${MANPREFIX}/man$${man##*.}/$${man##*/}; \ + chmod 644 ${DESTDIR}${MANPREFIX}/man$${man##*.}/$${man##*/}; \ + done uninstall: for bin in ${BIN}; do rm -f ${DESTDIR}${BINDIR}/$${bin}; done + for man in ${MAN}; do rm -f ${DESTDIR}${MANPREFIX}/man$${man##*.}/$${man##*/}; done .PHONY: all clean install uninstall diff --git a/man/runsyssv.1 b/man/runsyssv.1 @@ -0,0 +1,15 @@ +.TH "RUNSYSSV" "1" "October 2020" "sysmgr-VERSION" "General Commands Manual" +.SH NAME +runsyssv \- run sysmgr services +.SH SYNOPSIS +runsyssv [service file] +.SH DESCRIPTION +runsyssv is the program that sysmgr uses in order to run, track, and properly +terminate services. It is normally meant to be used by sysmgr only, not by +users. +.SH AUTHOR +Cem Keylan <cem@ckyln.com> +.SH SEE ALSO +.BR +sysmgr(8) +svctl(1) diff --git a/man/svctl.1 b/man/svctl.1 @@ -0,0 +1,28 @@ +.TH "SVCTL" "1" "October 2020" "sysmgr-VERSION" "General Commands Manual" +.SH NAME +svctl \- service controller for sysmgr +.SH SYNOPSIS +svctl [operation] [service...] +.SH DESCRIPTION +svctl is a tool to interact with sysmgr services, and make sure they are started +or stopped properly. It has the following operations: +.TP +.B start/up +starts the given services +.TP +.B stop/down +stops the given services +.TP +.B restart +restarts the given services +.TP +.B once +starts a services and doesn't restart it if it ever goes down +.TP +.B stat/status +prints the status of the services, returns with exit status 1 if any of the +given services are down. +.SH AUTHOR +Cem Keylan <cem@ckyln.com> +.SH SEE ALSO +.BR sysmgr(8) diff --git a/man/sysmgr-depends.1 b/man/sysmgr-depends.1 @@ -0,0 +1,13 @@ +.TH "SYSMGR-DEPENDS" "1" "October 2020" "sysmgr-VERSION" "General Commands Manual" +.SH NAME +sysmgr-depends \- dependency manager for sysmgr services +.SH SYNOPSIS +sysmgr-depends [service...] +.SH DESCRIPTION +sysmgr-depends is a simple tool that can be incorporated into sysmgr services +to wait until the given services are up. +.SH AUTHOR +Cem Keylan <cem@ckyln.com> +.SH SEE ALSO +.BR svctl(1) +.BR sysmgr(8) diff --git a/man/sysmgr.8 b/man/sysmgr.8 @@ -0,0 +1,55 @@ +.TH "SYSMGR" "8" "October 2020" "sysmgr-VERSION" "System Manager's Manual" +.SH NAME +sysmgr \- system manager +.SH DESCRIPTION +sysmgr is a service supervisor for UNIX systems. It executes the service scripts +(usually shell scripts) from the service directory and restarts them if they go +down. +.SH USAGE +The operation of sysmgr is manipulated through +.BR svctl(1), +and +.BR RUNDIR +and +.BR SYSDIR +environment variables. +.SS Defining directories +The service directory and the run directory can be defined both through the +config.h file on compilation and during runtime from environment variables. +.SS Service scripts +Service scripts can be any executable, but are usually small shell scripts. Here +is an example: +.nf + + #!/bin/sh -e + exec httpd -f -p 8054 -h /var/www/html + +.fi +The exec call makes sure that sysmgr is tracking the pid of the actual process +rather than the shell script itself. +.SH SERVICE DEPENDENCIES +sysmgr doesn't deal with service dependencies on its own, but a sysmgr-depends +tool is provided in order to deal with such a requirement. You can use this tool +in your service scripts to wait until a service is up. The usage is as follows: +.nf + + #!/bin/sh -e + sysmgr-depends dbus + exec NetworkManager -n + +.fi +.SH STARTING SYSMGR ON BOOT +In order to start sysmgr, you need to implement it into your init\-scheme. For +sysvinit and its clones (such as busybox\-init) add a line to your inittab as +follows: + +.nf +::respawn:/usr/bin/sysmgr +.fi + +.SH AUTHOR +Cem Keylan <cem@ckyln.com> +.SH SEE ALSO +.BR svctl(1) +.BR runsyssv(1) +.BR sysmgr-depends(1)