[systemd-devel] Detect if a script runs during bootup

Tomasz Torcz tomek at pipebreaker.pl
Wed Nov 11 03:17:59 PST 2015


On Wed, Nov 11, 2015 at 12:03:10PM +0100, Frank Steiner wrote:
> Hi,
> 
> is there an easy way to figure out if a LSB script in /etc/init.d/
> is called during bootup by systemd? I need to distinguish the first
> execution during boot from subsequent calls (cron, manually etc.).
> 
> It seems that /sbin/runlevel returns "unknown" during bootup, but
> I'm not sure if this reliable or not.

  I would suggest splitting the "on boot only" part into separate
unit, with RemainAfterExit=true.  The main part should require boot-only
part.
  First of all, create a proper unit and drop LSB script.
 

-- 
Tomasz Torcz            There exists no separation between gods and men:
xmpp: zdzichubg at chrome.pl   one blends softly casual into the other.



More information about the systemd-devel mailing list