diff --git a/usr.sbin/service/service.8 b/usr.sbin/service/service.8 --- a/usr.sbin/service/service.8 +++ b/usr.sbin/service/service.8 @@ -48,6 +48,7 @@ .Nm .Op Fl j Ar jail .Op Fl v +.Op Fl x .Ar script .Ar command .Sh DESCRIPTION @@ -102,6 +103,8 @@ above, but list all of the files, not just what is enabled. .It Fl v Be slightly more verbose. +.It Fl x +Do not fail if the service file doesn't exists. .El .Sh ENVIRONMENT When used to run rc.d scripts the diff --git a/usr.sbin/service/service.sh b/usr.sbin/service/service.sh --- a/usr.sbin/service/service.sh +++ b/usr.sbin/service/service.sh @@ -45,11 +45,12 @@ 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 '-x Do not warn if rc file do not exists' echo '-v Verbose' echo '' } -while getopts 'j:ehlrRv' COMMAND_LINE_ARGUMENT ; do +while getopts 'j:ehlrRxv' COMMAND_LINE_ARGUMENT ; do case "${COMMAND_LINE_ARGUMENT}" in j) JAIL="${OPTARG}" ;; e) ENABLED=eopt ;; @@ -57,6 +58,7 @@ l) LIST=lopt ;; r) RCORDER=ropt ;; R) RESTART=Ropt ;; + x) FAIL=xopt ;; v) VERBOSE=vopt ;; *) usage ; exit 1 ;; esac @@ -175,7 +177,9 @@ fi done +if [ -z "${FAIL}" ]; then # If the script was not found -echo "$script does not exist in /etc/rc.d or the local startup" -echo "directories (${local_startup}), or is not executable" -exit 1 + echo "$script does not exist in /etc/rc.d or the local startup" + echo "directories (${local_startup}), or is not executable" + exit 1 +fi