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

Re: Insert a script into systemd boot order at a specific location



On Fri, Mar 13, 2015 at 09:20:53AM +0100, Christoph Pleger wrote:
> Hello,
> 
> for many years and up to Debian 7, I am using update-rc.d to define a
> specific location in the boot order, where a script is executed which
> automatically performs some administrative tasks. The script is executed
> after only very basic tasks have been performed, and before all other
> tasks. The definition of this boot order is especially easy with the LSB
> init script format, because using  Required-Start und X-Start-Before in my
> init script are sufficient.

According to
http://www.freedesktop.org/software/systemd/man/systemd.unit.html you
can specify "After=" and "Before=" in order to force your unit to start
in a specified position. The documentation suggests that you typically
list your "After=" units also in "Requires=" so that starting your unit
causes the "After=" units to be started too (but, presumably, if they're
optional, you wouldn't do that).

What I don't see immediately, is a way to say "After=a b c" and
"Before=everything_else". Clearly, you don't want to have to list all
other units in your "Before=" (because maintaining that would be a
nightmare).

Another alternative might be to create a target
http://www.freedesktop.org/software/systemd/man/systemd.target.html
which your runlevel depends on. The idea would be that you put the
"Before" units in one target, you put your script in the new targat and
depend on the "Before" target and then you have your runlevel (which is,
basically, everything else) which you adjust to depend on your new
target. AFAICT, targets happen strictly one after the other.

> 
> My question now is, how can I achieve almost the same boot order in Debian
> 8 with systemd? To summarize, the boot order should be like this:
> 
> 1. Only very basic things, like starting the static network connection and
> mounting file systems
> 
> 2. My script, with no other systemd boot task running concurrently
> 
> 3. Everything else
> 
> Regards
>   Christoph
> 
> 
> -- 
> To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org 
> with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
> Archive: [🔎] 44a83ee7b5362320eab735639d8edcaa.squirrel@postweb.cs.tu-dortmund.de">https://lists.debian.org/[🔎] 44a83ee7b5362320eab735639d8edcaa.squirrel@postweb.cs.tu-dortmund.de
> 

Attachment: signature.asc
Description: Digital signature


Reply to: