diff --git a/libexec/rc/rc.d/ipfw_netflow b/libexec/rc/rc.d/ipfw_netflow --- a/libexec/rc/rc.d/ipfw_netflow +++ b/libexec/rc/rc.d/ipfw_netflow @@ -48,7 +48,7 @@ ipfw_netflow_status() { - ipfw_netflow_is_running && echo "ipfw_netflow is active" || echo "ipfw_netflow is not active" + ipfw_netflow_is_running && echo "ipfw_netflow is active" || ( echo "ipfw_netflow is not active" && exit 1 ) } ipfw_netflow_start() diff --git a/libexec/rc/rc.d/jail b/libexec/rc/rc.d/jail --- a/libexec/rc/rc.d/jail +++ b/libexec/rc/rc.d/jail @@ -440,7 +440,11 @@ jail_status() { - $jail_jls -N + if [ -z `$jail_jls jid` ]; then + exit 1 + else + $jail_jls -N + fi } jail_start() diff --git a/libexec/rc/rc.d/zfskeys b/libexec/rc/rc.d/zfskeys --- a/libexec/rc/rc.d/zfskeys +++ b/libexec/rc/rc.d/zfskeys @@ -91,9 +91,13 @@ { local IFS=$(printf "\t") - list_datasets | while read kl fs ; do + if [ -z "`list_datasets`" ]; then + exit 1 + else + list_datasets | while read kl fs ; do echo "$fs: $(zfs get -Ho value keystatus "$fs")" done + fi } load_zfs_keys() diff --git a/usr.sbin/ip6addrctl/ip6addrctl.c b/usr.sbin/ip6addrctl/ip6addrctl.c --- a/usr.sbin/ip6addrctl/ip6addrctl.c +++ b/usr.sbin/ip6addrctl/ip6addrctl.c @@ -119,7 +119,7 @@ } if (l == 0) { printf("no source-address-selection policy is installed\n"); - return; + exit(1); } if ((buf = malloc(l)) == NULL) { errx(1, "malloc failed"); 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 @@ -42,6 +42,7 @@ echo '' echo "-j Perform actions within the named jail" echo '-e Show services that are enabled' + echo '-s Show status of (enabled) services' 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' @@ -49,14 +50,15 @@ echo '' } -while getopts 'j:ehlrRv' COMMAND_LINE_ARGUMENT ; do +while getopts 'ehj:lrRsv' COMMAND_LINE_ARGUMENT ; do case "${COMMAND_LINE_ARGUMENT}" in - j) JAIL="${OPTARG}" ;; e) ENABLED=eopt ;; h) usage ; exit 0 ;; + j) JAIL="${OPTARG}" ;; l) LIST=lopt ;; r) RCORDER=ropt ;; R) RESTART=Ropt ;; + s) STATUS=sopt ;; v) VERBOSE=vopt ;; *) usage ; exit 1 ;; esac @@ -111,7 +113,7 @@ exit 0 fi -if [ -n "$ENABLED" -o -n "$RCORDER" ]; then +if [ -n "$ENABLED" -o -n "$RCORDER" -o -n "$STATUS" ]; then # Copied from /etc/rc skip="-s nostart" if [ `/sbin/sysctl -n security.jail.jailed` -eq 1 ]; then @@ -124,6 +126,29 @@ files=`rcorder ${skip} /etc/rc.d/* ${local_rc} 2>/dev/null` fi +if [ -n "$STATUS" ]; then + for file in $files; do + if grep -q ^rcvar $file; then + eval `grep ^name= $file` + eval `grep ^rcvar $file` + if [ -n "$rcvar" ]; then + load_rc_config_var ${name} ${rcvar} + fi + if [ -n "$ENABLED" ] ; then + if ! checkyesno $rcvar 2>/dev/null; then + continue; + fi + fi + if $file 2>&1 | grep -q "status"; then + status="Not running" + $file onestatus 1>/dev/null 2>&1 && status="Running" + printf "%s^%s\n" "${name}" "${status}" + fi + fi + done | column -ts^ + exit 0 +fi + if [ -n "$ENABLED" ]; then for file in $files; do if grep -q ^rcvar $file; then