View | Details | Raw Unified | Return to bug 223325
Collapse All | Expand All

(-)b/usr.sbin/service/service.8 (+7 lines)
Lines 32-44 Link Here
32
.Nd "control (start/stop/etc.) or list system services"
32
.Nd "control (start/stop/etc.) or list system services"
33
.Sh SYNOPSIS
33
.Sh SYNOPSIS
34
.Nm
34
.Nm
35
.Op Fl j Ao jail Ac
35
.Fl e
36
.Fl e
36
.Nm
37
.Nm
38
.Op Fl j Ao jail Ac
37
.Fl R
39
.Fl R
38
.Nm
40
.Nm
41
.Op Fl j Ao jail Ac
39
.Op Fl v
42
.Op Fl v
40
.Fl l | r
43
.Fl l | r
41
.Nm
44
.Nm
45
.Op Fl j Ao jail Ac
42
.Op Fl v
46
.Op Fl v
43
.Ar <rc.d script> start|stop|etc.
47
.Ar <rc.d script> start|stop|etc.
44
.Sh DESCRIPTION
48
.Sh DESCRIPTION
Lines 54-59 the scripts using various criteria. Link Here
54
.Pp
58
.Pp
55
The options are as follows:
59
The options are as follows:
56
.Bl -tag -width F1
60
.Bl -tag -width F1
61
.It Fl j Ao jail Ac
62
Perform the given actions under the named jail.
57
.It Fl e
63
.It Fl e
58
List services that are enabled.
64
List services that are enabled.
59
The list of scripts to check is compiled using
65
The list of scripts to check is compiled using
Lines 107-112 The following are examples of typical usage of the Link Here
107
command:
113
command:
108
.Pp
114
.Pp
109
.Dl "service named status"
115
.Dl "service named status"
116
.Dl "service -j dns named status"
110
.Dl "service -rv"
117
.Dl "service -rv"
111
.Pp
118
.Pp
112
The following programmable completion entry can be use in
119
The following programmable completion entry can be use in
(-)b/usr.sbin/service/service.sh (-4 / +31 lines)
Lines 32-43 load_rc_config 'XXX' Link Here
32
usage () {
32
usage () {
33
	echo ''
33
	echo ''
34
	echo 'Usage:'
34
	echo 'Usage:'
35
	echo "${0##*/} -e"
35
	echo "${0##*/} [-j jail] -e"
36
	echo "${0##*/} -R"
36
	echo "${0##*/} [-j jail] -R"
37
	echo "${0##*/} [-v] -l | -r"
37
	echo "${0##*/} [-j jail] [-v] -l | -r"
38
	echo "${0##*/} [-v] <rc.d script> start|stop|etc."
38
	echo "${0##*/} [-j jail] [-v] <rc.d script> start|stop|etc."
39
	echo "${0##*/} -h"
39
	echo "${0##*/} -h"
40
	echo ''
40
	echo ''
41
	echo "-j	Perform actions within the named jail"
41
	echo '-e	Show services that are enabled'
42
	echo '-e	Show services that are enabled'
42
	echo "-R	Stop and start enabled $local_startup services"
43
	echo "-R	Stop and start enabled $local_startup services"
43
	echo "-l	List all scripts in /etc/rc.d and $local_startup"
44
	echo "-l	List all scripts in /etc/rc.d and $local_startup"
Lines 46-51 usage () { Link Here
46
	echo ''
47
	echo ''
47
}
48
}
48
49
50
# Only deal with the -j option here. If found, JAIL is set and the opt and
51
# arg are shifted out. OPTIND is left untouched.
52
while getopts 'jehlrRv' COMMAND_LINE_ARGUMENT ; do
53
	case "${COMMAND_LINE_ARGUMENT}" in
54
	j)	JAIL="$2" ; shift ; shift ;;
55
	esac
56
done
57
58
# If -j was provided, then we pass everthing along to the jexec command
59
# and execute `service` within the named JAIL. Provided that the jail
60
# actually exists, as checked by `jls`.
61
# We do this so that if the jail does exist, we can then return the exit
62
# code of `jexec` and it should be the exit code of whatever ran in the jail.
63
# There is a race condition here in that the jail might exist at `jls` time
64
# and be gone by `jexec` time, but it shouldn't be a big deal.
65
if [ -n "$JAIL" ]; then
66
	/usr/sbin/jls -j "$JAIL" 2>/dev/null >/dev/null
67
	if [ $? -ne 0 ]; then
68
		echo "Jail '$JAIL' does not exist."
69
		exit 1
70
	fi
71
72
	/usr/sbin/jexec -l "$JAIL" /usr/sbin/service $*
73
	exit $?
74
fi
75
49
while getopts 'ehlrRv' COMMAND_LINE_ARGUMENT ; do
76
while getopts 'ehlrRv' COMMAND_LINE_ARGUMENT ; do
50
	case "${COMMAND_LINE_ARGUMENT}" in
77
	case "${COMMAND_LINE_ARGUMENT}" in
51
	e)	ENABLED=eopt ;;
78
	e)	ENABLED=eopt ;;

Return to bug 223325