[systemd-devel] Detect if a script runs during bootup
zbyszek at in.waw.pl
Wed Nov 11 05:20:02 PST 2015
On Wed, Nov 11, 2015 at 12:17:59PM +0100, Tomasz Torcz wrote:
> 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
> First of all, create a proper unit and drop LSB script.
There's no distinction between "boot" and "subsequnct calls":
what if boot takes a bit longer and cron calls the script during
More information about the systemd-devel