From: Petter Reinholdtsen Date: Sun, 6 Jun 2010 21:59:38 +0000 (+0000) Subject: New entry. X-Git-Url: http://pere.pagekite.me/gitweb/homepage.git/commitdiff_plain/6ff737bc8ac10efd2ab793aa2bdf8ec3f7acd5bb New entry. --- diff --git a/blog/data/2010-06-06-upstart.txt b/blog/data/2010-06-06-upstart.txt new file mode 100644 index 0000000000..eb12f3b925 --- /dev/null +++ b/blog/data/2010-06-06-upstart.txt @@ -0,0 +1,44 @@ +Title: Upstart or sysvinit - as init.d scripts see it +Tags: english, debian, debian edu +Date: 2010-06-06 23:55 + +

If Debian is to migrate to upstart on Linux, I expect some init.d +scripts to migrate (some of) their operations to upstart, and will +need a way to behave differently when used with sysvinit and with +upstart. Because of this, I had a look at the environment variables +set when a init.d script is running under upstart, and when it is +not.

+ +

With upstart, I notice these environment variables are set like +this for a script started from rcS.d/ (ignoring some irrelevant +ones):

+ +
+DEFAULT_RUNLEVEL=2
+previous=N
+PREVLEVEL=
+RUNLEVEL=
+runlevel=S
+UPSTART_EVENTS=startup
+UPSTART_INSTANCE=
+UPSTART_JOB=rc-sysinit
+
+ +

With sysvinit, these environment variables are set for the same +script.

+ +
+INIT_VERSION=sysvinit-2.88
+previous=N
+PREVLEVEL=N
+RUNLEVEL=S
+runlevel=S
+
+ +

The RUNLEVEL and PREVLEVEL environment variables passed on from +sysvinit is not set by upstart. Not sure if it is intentional or not +to not be compatible with sysvinit in this regard.

+ +

For scripts needing to behave differently when upstart is used, +looking for the UPSTART_JOB environment variable seem to be a good +choice.