[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: BEGIN INIT INFO



On 05/08/2014 08:24 AM, Sorin Sbârnea wrote:
> I was looking for a way to run multiple instances of the same services and
> be able to reuse the init.d scripts.
> 
> I do have an init.d script that can be copied (or symlinked) that cam
> manage different instances (without interation).
> 
> Now there is only one problem:
> 
> # Provides:          scriptname
> 
> This doesn't seem to be dynamic in any way, the name there cannot be an
> environment variable (obviously the script itself is not executed in order
> to parse BEGIN INIT INFO
> 
> All I need is the ability to tell the parser to use the *filename* instead.
> 
> This should be easy to implement and could be triggered by a line like:
> 
> # Provides: $scriptname
> 
> What do you think about this? -- without this you cannot clone multiple
> services without having to modify each init.d script.

This would introduce a bit of complexity due to the common practice of
symlinking init scripts to per-runlevel directories (which Debian does
as well).  I doubt you're looking for "Provides: S30foobar" here.

That could probably be overcome, but especially with the move to
systemd, I'm not seeing that there's much interest in adding the kind of
complexity we'd need here.

You would need a process anyway for copying/symlinking the init.d
script; it wouldn't be too hard to switch out something like:

  cp foo.init /etc/init.d/foo

for:

  sed s,@SCRIPTNAME@,foo, < foo.init > /etc/init.d/foo
  chmod +x /etc/init.d/foo

and setting your init script's Provides line to:

  # Provides: @SCRIPTNAME@


Attachment: signature.asc
Description: OpenPGP digital signature


Reply to: