]> git.pld-linux.org Git - projects/rc-scripts.git/commitdiff
- include service type in --status-all
authorElan Ruusamäe <glen@pld-linux.org>
Thu, 21 Jul 2011 10:28:04 +0000 (10:28 +0000)
committerElan Ruusamäe <glen@pld-linux.org>
Thu, 21 Jul 2011 10:28:04 +0000 (10:28 +0000)
svn-id: @12264

service

diff --git a/service b/service
index 41790b363f06c0772f98e6d4316b5f1cf2107365..e77fb46024e54aa6142b886c22a781aefe46e947 100755 (executable)
--- a/service
+++ b/service
@@ -17,7 +17,7 @@ is_ignored_file() {
 }
 
 status_all() {
-       local SERVICE
+       local SERVICE TYPE
        cd ${SERVICEDIR}
        for SERVICE in *; do
                case "${SERVICE}" in
@@ -26,19 +26,26 @@ status_all() {
                *)
                if ! is_ignored_file "${SERVICE}" \
                                && [ -x "${SERVICEDIR}/${SERVICE}" ]; then
+                       if [ -f /etc/init/${SERVICE}.conf ]; then
+                               # U for upstart
+                               TYPE='U'
+                       else
+                               # S for SysVinit
+                               TYPE='S'
+                       fi
                        if ! grep -qs "\Wstatus)" "$SERVICE"; then
                                #printf " %s %-60s %s\n" "[?]" "$SERVICE:" "unknown" 1>&2
-                               echo " [ ? ]  $SERVICE" 1>&2
+                               echo " [ ? ]{$TYPE} $SERVICE" 1>&2
                                continue
                        else
                                out=$(env -i USE_UPSTART=$USE_UPSTART LANG="$LANG" PATH="$PATH" TERM="$TERM" "$SERVICEDIR/$SERVICE" status 2>&1)
                                if [ "$?" = "0" -a -n "$out" ]; then
                                        #printf " %s %-60s %s\n" "[+]" "$SERVICE:" "running"
-                                       echo " [ + ]  $SERVICE"
+                                       echo " [ + ]{$TYPE} $SERVICE"
                                        continue
                                else
                                        #printf " %s %-60s %s\n" "[-]" "$SERVICE:" "NOT running"
-                                       echo " [ - ]  $SERVICE"
+                                       echo " [ - ]{$TYPE} $SERVICE"
                                        continue
                                fi
                        fi
This page took 0.350057 seconds and 4 git commands to generate.