git: a84e01f02b15 - main - service(8): direct user to rc(8) for a list of valid commands

From: Daniel Ebdrup Jensen <debdrup_at_FreeBSD.org>
Date: Mon, 29 Jan 2024 17:49:03 UTC
The branch main has been updated by debdrup:

URL: https://cgit.FreeBSD.org/src/commit/?id=a84e01f02b15dc1ec091feab6e532d5ba36ffbbb

commit a84e01f02b15dc1ec091feab6e532d5ba36ffbbb
Author:     Lexi Winter <lexi@le-Fay.ORG>
AuthorDate: 2024-01-13 23:34:46 +0000
Commit:     Daniel Ebdrup Jensen <debdrup@FreeBSD.org>
CommitDate: 2024-01-29 17:47:09 +0000

    service(8): direct user to rc(8) for a list of valid commands
    
    New users may refer to service(8) to discover how to manage services,
    but this manpage does not explain which commands are permitted besides
    start/stop (for example, 'enable').  Add a paragraph that directs the
    reader to rc(8) to discover this.
    
    While here, add a few examples of common use-cases.
    
    Reported by:    Mina Galić <freebsd@igalic.co>
    Pull request:   https://github.com/freebsd/freebsd-src/pull/1057
---
 usr.sbin/service/service.8 | 51 ++++++++++++++++++++++++++++++++++++++++------
 1 file changed, 45 insertions(+), 6 deletions(-)

diff --git a/usr.sbin/service/service.8 b/usr.sbin/service/service.8
index ada0e6361fb8..2c5dfa3f3a66 100644
--- a/usr.sbin/service/service.8
+++ b/usr.sbin/service/service.8
@@ -22,7 +22,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.Dd November 9, 2021
+.Dd January 29, 2024
 .Dt SERVICE 8
 .Os
 .Sh NAME
@@ -64,6 +64,13 @@ see
 It can also be used to list
 the scripts using various criteria.
 .Pp
+The set of permissible values for
+.Ar command
+depends on the particular rc.d script being invoked.
+For a list of standard commands which are supported by most rc.d
+scripts, see
+.Xr rc 8 .
+.Pp
 The options are as follows:
 .Bl -tag -width F1
 .It Fl E Ar var=value
@@ -129,13 +136,44 @@ option is used, the corresponding variable is set accordingly.
 .Sh EXIT STATUS
 .Ex -std
 .Sh EXAMPLES
-The following are examples of typical usage of the
-.Nm
-command:
+These are some examples of the most common service commands.
+For a full list of commands available in most rc.d scripts, see
+.Xr rc 8 .
+.Pp
+Enable a service, then start it:
+.Bd -literal -offset -indent
+service sshd enable
+service sshd start
+.Ed
+.Pp
+Stop a service, then disable it:
+.Bd -literal -offset -indent
+service sshd stop
+service sshd disable
+.Ed
+.Pp
+Start a service which is not enabled:
+.Bd -literal -offset -indent
+service sshd onestart
+.Ed
+.Pp
+Report the status of a service:
 .Bd -literal -offset -ident
 service named status
-service -j dns named status
+.Ed
+.Pp
+Restart a service running in a jail:
+.Bd -literal -offset -indent
+service -j dns named restart
+.Ed
+.Pp
+Start a service with a specific environment variable set:
+.Bd -literal -offset -indent
 service -E LC_ALL=C.UTF-8 named start
+.Ed
+.Pp
+Report a verbose listing of all available services:
+.Bd -literal -offset -indent
 service -rv
 .Ed
 .Pp
@@ -164,7 +202,8 @@ complete -F _service service
 .Xr bash 1 Pq Pa ports/shells/bash ,
 .Xr rc.conf 5 ,
 .Xr rc 8 ,
-.Xr rcorder 8
+.Xr rcorder 8 ,
+.Xr sysrc 8
 .Sh HISTORY
 The
 .Nm