[Pkg-sysvinit-commits] r1839 - in sysvinit/trunk/debian: . service

Petter Reinholdtsen pere at alioth.debian.org
Sun Mar 21 09:25:25 UTC 2010


Author: pere
Date: 2010-03-21 09:25:24 +0000 (Sun, 21 Mar 2010)
New Revision: 1839

Modified:
   sysvinit/trunk/debian/changelog
   sysvinit/trunk/debian/service/service
Log:
Change service to use upstart for service management if an upstart
configuration exist.  Patch from Dustin Kirkland and Ubuntu.

Modified: sysvinit/trunk/debian/changelog
===================================================================
--- sysvinit/trunk/debian/changelog	2010-03-21 09:10:22 UTC (rev 1838)
+++ sysvinit/trunk/debian/changelog	2010-03-21 09:25:24 UTC (rev 1839)
@@ -3,6 +3,8 @@
   * Avoid killing processes managed by upstart, and print list of
     misbehaving processes.  Partly based on patch from Martin Pitt,
     Scott James Remnant and Ubuntu.
+  * Change service to use upstart for service management if an upstart
+    configuration exist.  Patch from Dustin Kirkland and Ubuntu.
 
  -- Petter Reinholdtsen <pere at debian.org>  Sun, 21 Mar 2010 10:00:15 +0100
 

Modified: sysvinit/trunk/debian/service/service
===================================================================
--- sysvinit/trunk/debian/service/service	2010-03-21 09:10:22 UTC (rev 1838)
+++ sysvinit/trunk/debian/service/service	2010-03-21 09:25:24 UTC (rev 1839)
@@ -44,6 +44,7 @@
 USAGE="Usage: `basename $0` < option > | --status-all | \
 [ service_name [ command | --full-restart ] ]"
 SERVICE=
+ACTION=
 SERVICEDIR="/etc/init.d"
 OPTIONS=
 
@@ -104,6 +105,8 @@
           fi
        elif [ -z "${SERVICE}" ]; then
          SERVICE="${1}"
+       elif [ -z "${ACTION}" ]; then
+         ACTION="${1}"
        else
          OPTIONS="${OPTIONS} ${1}"
        fi
@@ -112,8 +115,23 @@
    esac
 done
 
+if [ -r "/etc/init/${SERVICE}.conf" ]; then
+   # Upstart configuration exists for this job
+   case "${ACTION}" in
+      start|stop|restart|status|reload)
+         # Action is a valid upstart action
+         exec ${ACTION} ${SERVICE} ${OPTIONS}
+      ;;
+      force-reload)
+         # Upstart just uses reload for force-reload
+         exec reload ${SERVICE} ${OPTIONS}
+      ;;
+   esac
+fi
+
+# Otherwise, use the traditional sysvinit
 if [ -x "${SERVICEDIR}/${SERVICE}" ]; then
-   env -i LANG="$LANG" PATH="$PATH" TERM="$TERM" "$SERVICEDIR/$SERVICE" ${OPTIONS}
+   exec env -i LANG="$LANG" PATH="$PATH" TERM="$TERM" "$SERVICEDIR/$SERVICE" ${ACTION} ${OPTIONS}
 else
    echo "${SERVICE}: unrecognized service" >&2
    exit 1




More information about the Pkg-sysvinit-commits mailing list