SVN: rc-scripts/branches/upstart_native: doc/upstart.txt service

jajcus jajcus at pld-linux.org
Fri May 7 10:21:08 CEST 2010


Author: jajcus
Date: Fri May  7 10:21:08 2010
New Revision: 11395

Modified:
   rc-scripts/branches/upstart_native/doc/upstart.txt
   rc-scripts/branches/upstart_native/service
Log:
- --upstart and --no-upstart options to /sbin/service

Modified: rc-scripts/branches/upstart_native/doc/upstart.txt
==============================================================================
--- rc-scripts/branches/upstart_native/doc/upstart.txt	(original)
+++ rc-scripts/branches/upstart_native/doc/upstart.txt	Fri May  7 10:21:08 2010
@@ -14,10 +14,12 @@
 An init script may be called with ``USE_UPSTART=no`` environment variable
 to disable special upstart-related processing – this way one may use
 ``/etc/rc.d/init.d/$service start`` to start a service even if upstart job 
-for that service is present.
+for that service is present. The ``/sbin/service`` script has two new options
+``--upstart`` and ``--no-upstart`` to force new- or old-style service control.
 
 ``USE_UPSTART=no`` can also be places in ``/etc/sysconfig/system``
-configuration file.
+configuration file, though it can break ``*-upstart`` packages
+installation/removal a bit.
 
 Available events
 ----------------

Modified: rc-scripts/branches/upstart_native/service
==============================================================================
--- rc-scripts/branches/upstart_native/service	(original)
+++ rc-scripts/branches/upstart_native/service	Fri May  7 10:21:08 2010
@@ -9,6 +9,7 @@
 [ service_name [ command | --full-restart ] ]"
 
 SERVICE=
+USE_UPSTART=
 
 if [ -d /etc/rc.d/init.d ]; then
 	SERVICEDIR="/etc/rc.d/init.d"
@@ -32,6 +33,14 @@
 		echo "${VERSION}" >&2
 		exit 0
 		;;
+	  --upstart)
+	  	USE_UPSTART=yes
+		shift
+		;;
+	  --no-upstart)
+	  	USE_UPSTART=no
+		shift
+		;;
 	  *)
 		if [ -z "${SERVICE}" -a $# -eq 1 -a "${1}" = "--status-all" ]; then
 			cd ${SERVICEDIR}
@@ -42,7 +51,7 @@
 					;;
 				  *)
 					if [ -x "${SERVICEDIR}/${SERVICE}" ]; then
-						env -i LANG=$LANG PATH=$PATH TERM=$TERM "${SERVICEDIR}/${SERVICE}" status
+						env -i USE_UPSTART=$USE_UPSTART LANG=$LANG PATH=$PATH TERM=$TERM "${SERVICEDIR}/${SERVICE}" status
 					fi
 					;;
 				esac
@@ -51,8 +60,8 @@
 		elif [ $# -eq 2 -a "${2}" = "--full-restart" ]; then
 			SERVICE="${1}"
 			if [ -x "${SERVICEDIR}/${SERVICE}" ]; then
-				env -i LANG=$LANG PATH=$PATH TERM=$TERM "${SERVICEDIR}/${SERVICE}" stop
-				env -i LANG=$LANG PATH=$PATH TERM=$TERM "${SERVICEDIR}/${SERVICE}" start
+				env -i USE_UPSTART=$USE_UPSTART LANG=$LANG PATH=$PATH TERM=$TERM "${SERVICEDIR}/${SERVICE}" stop
+				env -i USE_UPSTART=$USE_UPSTART LANG=$LANG PATH=$PATH TERM=$TERM "${SERVICEDIR}/${SERVICE}" start
 				exit $?
 			fi
 		elif [ -z "${SERVICE}" ]; then
@@ -66,7 +75,7 @@
 done
 
 if [ -x "${SERVICEDIR}/${SERVICE}" ]; then
-	env -i LANG=$LANG PATH=$PATH TERM=$TERM "${SERVICEDIR}/${SERVICE}" ${OPTIONS}
+	env -i USE_UPSTART=$USE_UPSTART LANG=$LANG PATH=$PATH TERM=$TERM "${SERVICEDIR}/${SERVICE}" ${OPTIONS}
 else
 	echo "${SERVICE}: unrecognized service" >&2
 	exit 1


More information about the pld-cvs-commit mailing list