mirror of
https://git.freebsd.org/src.git
synced 2026-01-11 19:57:22 +00:00
service: Add an option to enable debugging
* Add and document a -d option which enables rc script debugging. * Sort and document existing options correctly. MFC after: 1 week Reviewed by: imp, emaste Differential Revision: https://reviews.freebsd.org/D51700
This commit is contained in:
parent
cf0f693f03
commit
25fca243f2
2 changed files with 21 additions and 11 deletions
|
|
@ -22,7 +22,7 @@
|
|||
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
.\" SUCH DAMAGE.
|
||||
.\"
|
||||
.Dd May 9, 2025
|
||||
.Dd August 2, 2025
|
||||
.Dt SERVICE 8
|
||||
.Os
|
||||
.Sh NAME
|
||||
|
|
@ -34,6 +34,7 @@
|
|||
.Fl e
|
||||
.Nm
|
||||
.Op Fl j Ar jail
|
||||
.Op Fl q
|
||||
.Fl R
|
||||
.Nm
|
||||
.Op Fl j Ar jail
|
||||
|
|
@ -45,8 +46,7 @@
|
|||
.Fl r
|
||||
.Nm
|
||||
.Op Fl j Ar jail
|
||||
.Op Fl q
|
||||
.Op Fl v
|
||||
.Op Fl dqv
|
||||
.Op Fl E Ar var=value
|
||||
.Ar script
|
||||
.Op Ar command
|
||||
|
|
@ -74,6 +74,8 @@ scripts, see
|
|||
.Pp
|
||||
The options are as follows:
|
||||
.Bl -tag -width F1
|
||||
.It Fl d
|
||||
Enable debugging.
|
||||
.It Fl E Ar var=value
|
||||
Set the environment variable
|
||||
.Ar var
|
||||
|
|
@ -106,6 +108,9 @@ this is usually
|
|||
.Pa /usr/local/etc/rc.d .
|
||||
All files will be listed whether they are an actual
|
||||
rc.d script or not.
|
||||
.It Fl q
|
||||
Be quiet, redirecting output to
|
||||
.Pa /dev/null .
|
||||
.It Fl R
|
||||
Restart all enabled local services.
|
||||
.It Fl r
|
||||
|
|
@ -116,8 +121,6 @@ as in
|
|||
above, but list all of the files, not just what is enabled.
|
||||
.It Fl v
|
||||
Be slightly more verbose.
|
||||
.It Fl q
|
||||
Be quiet, redirecting output to /dev/null.
|
||||
.El
|
||||
.Sh ENVIRONMENT
|
||||
When used to run rc.d scripts the
|
||||
|
|
|
|||
|
|
@ -27,17 +27,19 @@
|
|||
# SUCH DAMAGE.
|
||||
|
||||
. /etc/rc.subr
|
||||
load_rc_config 'XXX'
|
||||
load_rc_config
|
||||
|
||||
usage () {
|
||||
echo ''
|
||||
echo 'Usage:'
|
||||
echo "${0##*/} [-j <jail name or id>] -e"
|
||||
echo "${0##*/} [-j <jail name or id>] -R"
|
||||
echo "${0##*/} [-j <jail name or id>] [-v] -l | -r"
|
||||
echo "${0##*/} [-j <jail name or id>] [-v] [-E var=value] <rc.d script> start|stop|etc."
|
||||
echo "${0##*/} [-j <jail name or id>] [-q] -R"
|
||||
echo "${0##*/} [-j <jail name or id>] [-v] -l"
|
||||
echo "${0##*/} [-j <jail name or id>] [-v] -r"
|
||||
echo "${0##*/} [-j <jail name or id>] [-dqv] [-E var=value] <rc.d script> start|stop|etc."
|
||||
echo "${0##*/} -h"
|
||||
echo ''
|
||||
echo "-d Enable debugging of rc.d scripts"
|
||||
echo "-j Perform actions within the named jail"
|
||||
echo "-E n=val Set variable n to val before executing the rc.d script"
|
||||
echo '-e Show services that are enabled'
|
||||
|
|
@ -49,12 +51,13 @@ usage () {
|
|||
echo ''
|
||||
}
|
||||
|
||||
while getopts 'j:E:ehlqrRv' COMMAND_LINE_ARGUMENT ; do
|
||||
while getopts 'dE:ehj:lqrRv' COMMAND_LINE_ARGUMENT ; do
|
||||
case "${COMMAND_LINE_ARGUMENT}" in
|
||||
j) JAIL="${OPTARG}" ;;
|
||||
d) DEBUG=dopt ;;
|
||||
E) VARS="${VARS} ${OPTARG}" ;;
|
||||
e) ENABLED=eopt ;;
|
||||
h) usage ; exit 0 ;;
|
||||
j) JAIL="${OPTARG}" ;;
|
||||
l) LIST=lopt ;;
|
||||
q) QUIET=qopt ;;
|
||||
r) RCORDER=ropt ;;
|
||||
|
|
@ -85,6 +88,10 @@ if [ -n "${JAIL}" ]; then
|
|||
exit $?
|
||||
fi
|
||||
|
||||
if [ -n "$DEBUG" ]; then
|
||||
VARS="${VARS} rc_debug=yes"
|
||||
fi
|
||||
|
||||
if [ -n "$RESTART" ]; then
|
||||
skip="-s nostart"
|
||||
if [ `/sbin/sysctl -n security.jail.jailed` -eq 1 ]; then
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue