p Its purpose is to list the services or invoke actions on them as provided by the .Xr rc.d 8 scripts. When used to invoke
a rc.d scripts, .Nm will set the same environment that is used at boot time.
p The options are as follows: l -tag -width Fl t Fl e List services that are enabled. The list of scripts is compiled using .Xr rcorder 8 the same way as is done in .Xr rc 8 ; each script is first checked for an .Dv rcvar assignment and if present, checked to see if it is enabled. If one or more .Ar rc_script_name are specified, only those are checked. The .Ar rc_script_name arguments are always specified without a path prefix. t Fl l List all files in
o the default of .Ev rc_directories as defined in .Xr rc.conf 5
c . A script will be listed unless it has the .Dv nostart keyword enabled. Scripts are listed in the order the
a rc.d system runs them at system boot time. t Fl v Report what .Dv rc_directories are defined or in which directory the
a rc.d script was found when an .Ar action is invoked. .El
p The .Fl e and .Fl l options are mutually exclusive. Only one of those may be used. .Sh ENVIRONMENT When used to invoke
a rc.d scripts, the .Nm command sets .Xr umask 2 to .Li 022 , .Ev HOME to
a / , and .Ev PATH to .Li /sbin:/bin:/usr/sbin:/usr/bin which is how they are set in
a /etc/rc at boot time. The .Ar action is typically one of .Cm start , .Cm restart , or .Cm status , but can be any other argument supported by the .Fa rc_script_name . .Sh EXIT STATUS .Nm exits with status 0 when successful, status 1 when .Fl e was given and no enabled script was found, or when an .Ar action is to be performed, but the .Ar rc_script_name given does not exist, or status >1 if another error occurs. .Sh EXAMPLES These are typical usages of the .Nm command: d -literal # service sshd restart Stopping sshd. Starting sshd. .Ed d -literal $ service -v inetd status inetd is located in /etc/rc.d inetd is running as pid 1713. .Ed d -literal $ if service -e inetd >/dev/null; then echo inetd is enabled; fi inetd is enabled .Ed d -literal $ if service -e foobar >/dev/null; then echo foobar is enabled; fi .Ed d -literal $ service -ve ccd motd hostapd my_pkg rc_directories is /etc/rc.d /usr/pkg/etc/rc.d /etc/rc.d/ccd /usr/pkg/etc/rc.d/my_pkg /etc/rc.d/motd .Ed
p In the last example, .Xr hostapd 8 was apparently left disabled and the additional directory
a /usr/pkg/etc/rc.d was configured by redefining the variable .Dv rc_directories in
a rc.conf ; further, .Li my_pkg=yes must have also been set. .Sh SEE ALSO .Xr rc.conf 5 , .Xr rc 8 , .Xr rcorder 8 .Sh HISTORY The .Nm utility first appeared in .Nx 7.0 . .Sh AUTHORS .An -nosplit Written for .Fx by .An Douglas Barton Aq Mt dougb (at] FreeBSD.org .
p Adapted and extended to .Nx by .An Adrian Steinmann Aq Mt ast (at] marabu.ch .