[arch-projects] [INITSCRIPTS][PATCH 1/3] rc.d: Add started/stopped option to list

Sebastien Luttringer seblu at seblu.net
Fri Jun 17 21:31:05 EDT 2011


This patch allow rc.d list started and rc.d list stopped which list respectively
only started and stopped daemons

Signed-off-by: Sebastien Luttringer <seblu at seblu.net>
---
 rc.d |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/rc.d b/rc.d
index ad0a1e9..23f89d4 100755
--- a/rc.d
+++ b/rc.d
@@ -23,13 +23,16 @@ case $1 in
 		usage
 		;;
 	list)
+		shift
 		cd /etc/rc.d/
 		for d in *; do
 			have_daemon "$d" || continue
 			# print running / stopped satus
 			if ! ck_daemon "$d"; then
+				[[ "$1" == stopped ]] && continue
 				printf "${C_OTHER}[${C_DONE}STARTED${C_OTHER}]"
 			else
+				[[ "$1" == started ]] && continue
 				printf "${C_OTHER}[${C_FAIL}STOPPED${C_OTHER}]"
 			fi
 			# print auto / manual status
@@ -40,7 +43,7 @@ case $1 in
 			fi
 			printf " ${C_CLEAR}$d\n"
 		done
-		;;
+	;;
 	*)
 		# check min args count
 		(( $# < 2 )) && usage
@@ -62,6 +65,7 @@ case $1 in
 			fi
 			(( ret += !! $? ))  # clamp exit value to 0/1
 		done
+	;;
 esac
 
 exit $ret
-- 
Sebastien "Seblu" Luttringer



More information about the arch-projects mailing list