Date: Mon, 26 Sep 2011 04:55:20 +0000 (UTC) From: Martin Tournoij <martin@arp242.net> To: FreeBSD-gnats-submit@FreeBSD.org Subject: bin/161028: [PATCH] usr.sbin/service/ -- Minor improvements Message-ID: <20110926045520.286D9106564A@hub.freebsd.org> Resent-Message-ID: <201109260500.p8Q50Lqm009583@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 161028 >Category: bin >Synopsis: [PATCH] usr.sbin/service/ -- Minor improvements >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Mon Sep 26 05:00:21 UTC 2011 >Closed-Date: >Last-Modified: >Originator: Martin >Release: FreeBSD 9.0-BETA3 amd64 >Organization: >Environment: System: FreeBSD thinkpad 9.0-BETA3 FreeBSD 9.0-BETA3 #0: Sat Sep 24 08:53:22 CEST 2011 martin@thinkpad:/usr/obj/usr/src/sys/GENERIC amd64 >Description: Minor update to /usr/sbin/service - Add -s commands shows the status of the scripts. - Update manpage >How-To-Repeat: >Fix: --- service.diff begins here --- diff -u usr.sbin/service.orig/service.8 usr.sbin/service/service.8 --- usr.sbin/service.orig/service.8 2011-09-26 05:16:50.000000000 +0200 +++ usr.sbin/service/service.8 2011-09-26 05:12:35.000000000 +0200 @@ -62,6 +62,9 @@ .Qq rcvar assignment. If present the script is checked to see if it is enabled. +.It Fl s +Check the status of all the services that are enabled. You need to be root to +execute this. .It Fl l List all files in .Pa /etc/rc.d @@ -115,8 +118,14 @@ .Dl " return 0" .Dl "}" .Dl "complete -F _service service" +.Pp +Or for +.Xr tcsh 1 +you can use: +.Dl complete service 'n/*/`service -l`/' .Sh SEE ALSO .Xr bash 1 Pq Pa ports/shells/bash , +.Xr tcsh 1 , .Xr rc.conf 5 , .Xr rc 8 , .Xr rcorder 8 diff -u usr.sbin/service.orig/service.sh usr.sbin/service/service.sh --- usr.sbin/service.orig/service.sh 2011-09-26 05:16:50.000000000 +0200 +++ usr.sbin/service/service.sh 2011-09-26 05:15:32.000000000 +0200 @@ -33,20 +33,23 @@ echo '' echo 'Usage:' echo "${0##*/} -e" + echo "${0##*/} -s" 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 '-s Show status of enabled 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 'eshlrv' COMMAND_LINE_ARGUMENT ; do case "${COMMAND_LINE_ARGUMENT}" in e) ENABLED=eopt ;; + s) ENABLED=sopt ;; h) usage ; exit 0 ;; l) LIST=lopt ;; r) RCORDER=ropt ;; @@ -67,11 +70,22 @@ fi if [ -n "$ENABLED" ]; then + if [ "$ENABLED" = "sopt" ] && [ `id -u` -ne 0 ]; then + echo "You need to be root to use -s" + exit 1 + fi + for file in $files; do if grep -q ^rcvar $file; then eval `grep ^name= $file` eval `grep ^rcvar $file` - checkyesno $rcvar 2>/dev/null && echo $file + if [ "$ENABLED" = "eopt" ]; then + checkyesno $rcvar 2>/dev/null && echo $file + else + if grep -q ^pidfile= $file; then + checkyesno $rcvar 2>/dev/null && echo -n "${file}: " && $file status && echo "" + fi + fi fi done exit 0 --- service.diff ends here --- >Release-Note: >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20110926045520.286D9106564A>