mirror of
https://github.com/freebsd/freebsd-src.git
synced 2024-12-04 05:58:57 +00:00
Add -R, an option to restart all enabled "local" services.
Discussed on: -rc@ (in September) MFC after: 2 months
This commit is contained in:
parent
07588bf421
commit
f292f6dd5e
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=244132
@ -24,7 +24,7 @@
|
||||
.\"
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.Dd December 26, 2009
|
||||
.Dd December 11, 2012
|
||||
.Dt SERVICE 8
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -34,6 +34,8 @@
|
||||
.Nm
|
||||
.Fl e
|
||||
.Nm
|
||||
.Fl R
|
||||
.Nm
|
||||
.Op Fl v
|
||||
.Fl l | r
|
||||
.Nm
|
||||
@ -62,6 +64,8 @@ then that list of scripts is checked for an
|
||||
.Qq rcvar
|
||||
assignment.
|
||||
If present the script is checked to see if it is enabled.
|
||||
.It Fl R
|
||||
Restart all enabled local services.
|
||||
.It Fl l
|
||||
List all files in
|
||||
.Pa /etc/rc.d
|
||||
|
@ -33,29 +33,58 @@ usage () {
|
||||
echo ''
|
||||
echo 'Usage:'
|
||||
echo "${0##*/} -e"
|
||||
echo "${0##*/} -R"
|
||||
echo "${0##*/} [-v] -l | -r"
|
||||
echo "${0##*/} [-v] <rc.d script> start|stop|etc."
|
||||
echo "${0##*/} -h"
|
||||
echo ''
|
||||
echo '-e Show services that are enabled'
|
||||
echo "-R Stop and start enabled $local_startup services"
|
||||
echo "-l List all scripts in /etc/rc.d and $local_startup"
|
||||
echo '-r Show the results of boot time rcorder'
|
||||
echo '-v Verbose'
|
||||
echo ''
|
||||
}
|
||||
|
||||
while getopts 'ehlrv' COMMAND_LINE_ARGUMENT ; do
|
||||
while getopts 'ehlrRv' COMMAND_LINE_ARGUMENT ; do
|
||||
case "${COMMAND_LINE_ARGUMENT}" in
|
||||
e) ENABLED=eopt ;;
|
||||
h) usage ; exit 0 ;;
|
||||
l) LIST=lopt ;;
|
||||
r) RCORDER=ropt ;;
|
||||
R) RESTART=Ropt ;;
|
||||
v) VERBOSE=vopt ;;
|
||||
*) usage ; exit 1 ;;
|
||||
esac
|
||||
done
|
||||
shift $(( $OPTIND - 1 ))
|
||||
|
||||
if [ -n "$RESTART" ]; then
|
||||
skip="-s nostart"
|
||||
if [ `/sbin/sysctl -n security.jail.jailed` -eq 1 ]; then
|
||||
skip="$skip -s nojail"
|
||||
fi
|
||||
[ -n "$local_startup" ] && find_local_scripts_new
|
||||
files=`rcorder ${skip} ${local_rc} 2>/dev/null`
|
||||
|
||||
for file in `reverse_list ${files}`; do
|
||||
if grep -q ^rcvar $file; then
|
||||
eval `grep ^name= $file`
|
||||
eval `grep ^rcvar $file`
|
||||
checkyesno $rcvar 2>/dev/null && run_rc_script ${file} stop
|
||||
fi
|
||||
done
|
||||
for file in $files; do
|
||||
if grep -q ^rcvar $file; then
|
||||
eval `grep ^name= $file`
|
||||
eval `grep ^rcvar $file`
|
||||
checkyesno $rcvar 2>/dev/null && run_rc_script ${file} start
|
||||
fi
|
||||
done
|
||||
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ -n "$ENABLED" -o -n "$RCORDER" ]; then
|
||||
# Copied from /etc/rc
|
||||
skip="-s nostart"
|
||||
|
Loading…
Reference in New Issue
Block a user