svc

Unnamed repository; edit this file 'description' to name the repository.
Дневник | Датотеке | Референце | ПРОЧИТАЈМЕ | ЛИЦЕНЦА

чување 8eaf83da74d294bd95910b2268fefcc205cb1f1f
родитељ 30d7c51fdc8281cd241efc822a68626a5a81f46e
Аутор: Страхиња Радић <contact@strahinja.org>
Датум:   Thu, 21 Jul 2022 17:06:34 +0200

Update license; add manpages for svc and service

Signed-off-by: Страхиња Радић <contact@strahinja.org>

Diffstat:
MLICENSE | 1+
Mbin/svc | 15++++++++-------
Aservice.8 | 87+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Asvc.8 | 100+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
измењених датотека: 4, додавања: 196(+), брисања: 7(-)

diff --git a/LICENSE b/LICENSE @@ -1,6 +1,7 @@ MIT/X Consortium License © 2012-14 Christoph Lohmann <20h@r-36.net> +© 2022 Strahinya Radich <contact@strahinja.org> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), diff --git a/bin/svc b/bin/svc @@ -14,7 +14,7 @@ BASEDIR="/bin/svc.d" BASENAME="${0##*/}" usage() { - printf "usage: %s [-acedklrs] [service]\n" "$BASENAME" >&2 + printf "usage: %s [-acdeklrs] [service]\n" "$BASENAME" >&2 exit 2 } @@ -29,6 +29,7 @@ fi if [ $# -lt 1 ]; then usage + exit 2 fi runservice() { @@ -76,8 +77,8 @@ case "$1" in -a) if [ $# -gt 1 ] && [ -e "avail/$2" ]; then ln -sf "../avail/$2" "run/$2" - printf "%s: '%s' activated.\n" \ - "${BASENAME}" "$2" + #printf "%s: '%s' activated.\n" \ + # "${BASENAME}" "$2" else cd run ls . @@ -89,11 +90,11 @@ case "$1" in -d) if [ $# -gt 1 ] && [ -e "run/$2" ]; then rm -f "run/$2" - printf "%s: '%s' deactivated.\n" \ - "$BASENAME" "$2" + #printf "%s: '%s' deactivated.\n" \ + # "$BASENAME" "$2" else - printf "%s: No service given or service is not marked as to run.\n" \ - "$BASENAME" >&2 + printf "%s: No service given or service is not marked "\ +"as to run.\n" "$BASENAME" >&2 exit 2 fi;; -e|-k|-s|-r) diff --git a/service.8 b/service.8 @@ -0,0 +1,87 @@ +.Dd July 21, 2022 +.Dt SERVICE 8 SMM +.Os Galeb 2.0 +.Sh NAME +.Nm service +.Nd manage services +.Sh SYNOPSIS +.Nm +.Op Ar operation +.Op Ar service | Cm all +.Sh DESCRIPTION +Most of the options accept either the service name or the special keyword +.Dq Cm all , +which applies the operation to all the related services. +. +.Bl -tag -width ".Nm Fl a" -offset indent +. +.It Nm Cm a(ctivate) Op Ar service | Cm all +activates the service +.Dq Ar service . +. +.It Nm Cm a(ctivate)d Op Ar service | Cm all +checks if the service +.Dq Ar service +is activated in +.Pa /bin/svc.d/run . +. +.It Nm Cm d(eactivate) Op Ar service | Cm all +deactivates the service +.Dq Ar service . +. +.It Nm Cm e(xists) Op Ar service | Cm all +checks if the service +.Dq Ar service +is running. +. +.It Nm Cm l(ist) +lists all available (not necessarily activated) services in the directory +.Pa /bin/svc.d/avail . +. +.It Nm Cm r(estart) Op Ar service | Cm all +restarts the service. +. +.It Nm Cm sta(rt) Op Ar service | Cm all +starts the service. +. +.It Nm Cm sto(p) Op Ar service | Cm all +stops the service. +.El +.Sh FILES +.Bl -tag -width ".Pa /bin/svc.d/bin" +.It Pa /bin/svc.d/avail +service scripts which are available for activation. +.It Pa /bin/svc.d/default +service configuration files. +.It Pa /bin/svc.d/run +symlinks to activated service scripts. +.El +.Sh EXIT STATUS +.Xr svc 8 , +.Nm +and service scripts themselves should set the exit status to one of the +following: +.Bl -tag -offset indent +.It 0 +success. +. +.It 1 +redundancy; for example, if starting the service was attempted when the service +is already running. +. +.It 2 +general error. +.El +.Sh SEE ALSO +.Xr svc 8 +.Sh HISTORY +.Xr svc +and related commands were made by Cristoph Lohmann in 2012. The version used in +Galeb is heavily modified and documented by Strahinya Radich in 2022. +.Sh AUTHORS +.An "Cristoph Lohmann" Aq 20h@r-36.net , +2012-2014 original author +.An "Strahinya Radich" Aq contact@strahinja.org , +2022, reorganized +.Xr svc +and created the manpage. diff --git a/svc.8 b/svc.8 @@ -0,0 +1,100 @@ +.Dd July 21, 2022 +.Dt SVC 8 SMM +.Os Galeb 2.0 +.Sh NAME +.Nm svc +.Nd manage services +.Sh SYNOPSIS +.Nm +.Op Fl acdeklrs | ad +.Op Ar service | Cm all +.Sh DESCRIPTION +Most of the options accept either the service name or the special keyword +.Dq Cm all , +which applies the operation to all the related services. +. +.Bl -tag -width ".Nm Fl a" -offset indent +. +.It Nm Fl a +lists all activated services in +.Pa /bin/svc.d/run . +. +.It Nm Fl a Op Ar service | Cm all +activates the service +.Dq Ar service . +. +.It Nm Fl ad Op Ar service +checks if the service +.Dq Ar service +is activated in the directory +.Pa /bin/svc.d/run . +. +.It Nm Fl c +configures +.Nm +by creating the necessary subdirectories of +.Pa /bin/svc.d . +. +.It Nm Fl d Op Ar service | Cm all +deactivates the service +.Dq Ar service . +. +.It Nm Fl e Op Ar service | Cm all +checks if the service +.Dq Ar service +is running +.Pq Dq exists . +. +.It Nm Fl k Op Ar service | Cm all +stops +.Pq Dq kills +the service. +. +.It Nm Fl l +lists all available (not necessarily activated) services in the directory +.Pa /bin/svc.d/avail . +. +.It Nm Fl r Op Ar service | Cm all +restarts the service. +. +.It Nm Fl s Op Ar service | Cm all +starts the service. +.El +.Sh FILES +.Bl -tag -width ".Pa /bin/svc.d/bin" +.It Pa /bin/svc.d/avail +service scripts which are available for activation. +.It Pa /bin/svc.d/default +service configuration files. +.It Pa /bin/svc.d/run +symlinks to activated service scripts. +.El +.Sh EXIT STATUS +.Nm , +.Xr service 8 +and service scripts themselves should set the exit status to one of the +following: +.Bl -tag -offset indent +.It 0 +success. +. +.It 1 +redundancy; for example, if starting the service was attempted when the service +is already running. +. +.It 2 +general error. +.El +.Sh SEE ALSO +.Xr service 8 +.Sh HISTORY +.Nm +and related commands were made by Cristoph Lohmann in 2012. The version used in +Galeb is heavily modified and documented by Strahinya Radich in 2022. +.Sh AUTHORS +.An "Cristoph Lohmann" Aq 20h@r-36.net , +2012-2014 original author +.An "Strahinya Radich" Aq contact@strahinja.org , +2022, reorganized +.Nm +and created the manpage.