rc.local should support a runparts of rc.local.d

Bug #915215 reported by Scott Moser on 2012-01-12
This bug affects 4 people
Affects Status Importance Assigned to Milestone
sysvinit (Ubuntu)
Scott Moser

Bug Description

the current rc.local script that gets installed is difficult to work with.

For doing simple things like "i just want to run this at the end of boot", the 'exit 0' at the end means that human editing is almost required to do so without possibly breaking other content that might be in it.

ie, right now we have:
# some comments here

exit 0

that makes it very difficult to add a command.

2 solutions for this:
1.) drop 'exit 0', its completely unnecessary
2.) support runparts

runparts means something that wants to simply add a script can do so, and it can easily be deleted.

ProblemType: Bug
DistroRelease: Ubuntu 12.04
Package: initscripts 2.88dsf-13.10ubuntu8
ProcVersionSignature: Ubuntu 3.2.0-7.13-generic 3.2.0-rc7
Uname: Linux 3.2.0-7-generic x86_64
ApportVersion: 1.90-0ubuntu1
Architecture: amd64
Date: Thu Jan 12 10:12:59 2012
EcryptfsInUse: Yes
InstallationMedia: Ubuntu 11.10 "Oneiric Ocelot" - Release amd64 (20111012)
 PATH=(custom, user)
SourcePackage: sysvinit
UpgradeStatus: Upgraded to precise on 2011-11-07 (65 days ago)

Related branches

Scott Moser (smoser) wrote :
Scott Moser (smoser) wrote :

just for reference, sed is easly:
  sed -i '$s/^exit 0$//'

Scott Moser (smoser) wrote :

better (thanks to rbasak), to just edit out that 'exit 0':
  sed -i '${/^exit 0$/d}' /etc/rc.local

Scott Moser (smoser) wrote :

Upon further thought, i think the easiest path here is to simply add a /etc/init.d/rc.local_d script that (or potentially as an upstart job) that runs stuff in /etc/init.d/rc.local.d

that way we dont have to deal with the potential of user having modified /etc/rc.local .

Scott Moser (smoser) wrote :

just for reference, but I think i'm not going to use it, here is an upstart job for rc.local.d scripts:

# rc-local-d - run scripts in /etc/rc.local.d in run-parts fashion
# after /etc/rc.local has finished
# This extends traditional rc.local to support run-parts

description "run scripts in /etc/rc.local.d at traditional rc.local timeframe"
author "Scott Moser <email address hidden>"

start on stopped rc RUNLEVEL=[2345]
stop on runlevel [016]

console output
   command -v run-parts >/dev/null || exit 0
   [ -d /etc/rc.local.d ] || exit 0
   exec run-parts /etc/rc.local.d
end script

Scott Moser (smoser) on 2012-01-30
Changed in sysvinit (Ubuntu):
status: New → In Progress
importance: Undecided → Low
assignee: nobody → Scott Moser (smoser)
Serge Hallyn (serge-hallyn) wrote :

Hi Scott,

is there any reason not to first try going through Debian for this?

Scott Moser (smoser) wrote :

There has been some discussion on this bug in ubuntu-devel, and I realize that reading some of the comments above may be confusing, so I will summarize here.

 * The suggested merge proposal currently adds functional 'rc.local.d' behavior that would break anything. It does that with a new sysvinit script (rc.local.d). Clint suggested that it could/should be an upstart job, but I do not personally see that as an issue, nor do I think that by itself was blocking (The job could be changed to upstart later).
 * In the conversation on ubuntu-devel [1], Steve Langasek was not overjoyed by the idea of this change. His primary concern seemed to be that it was not sysvinit's job to provide this functionality.

Going forward, to address Steve's concerns, it might be best to simply add an rc.local.d package. I'm not actively pushing on this for 12.04, but may revisit in 12.10.

[1] http://irclogs.ubuntu.com/2012/02/07/%23ubuntu-devel.html#t20:12

Changed in sysvinit (Ubuntu):
importance: Low → Wishlist
status: In Progress → Triaged
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers