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

Frank Steiner fsteiner-mail1 at bio.ifi.lmu.de
Mon Nov 23 04:35:28 PST 2015

Colin Guthrie wrote

> Zbigniew Jędrzejewski-Szmek wrote on 11/11/15 15:55:
>> On Wed, Nov 11, 2015 at 04:39:23PM +0100, Frank Steiner wrote:
>>> Isn't there an easy way to figure out if this script is running
>>> inside the boot process? Some variable set or not yet set?
>> You can use systemctl is-system-running (see the man page).
> I guess another option would just be to write out a flag file into /run
> tree when you do the first call. First call the file won't exist, all
> subsequent calls it will.
> That might fit better with a scripted solution than calling out to an
> exec, but YMMV.

I finally did that and it works well, thanks :-)

Dipl.-Inform. Frank Steiner   Web:  http://www.bio.ifi.lmu.de/~steiner/
Lehrstuhl f. Bioinformatik    Mail: http://www.bio.ifi.lmu.de/~steiner/m/
LMU, Amalienstr. 17           Phone: +49 89 2180-4049
80333 Muenchen, Germany       Fax:   +49 89 2180-99-4049
* Rekursion kann man erst verstehen, wenn man Rekursion verstanden hat. *

More information about the systemd-devel mailing list