0

Normally sysv init scripts are run at boot time (from /etc/init.d/rcS) with the 'start' argument. However they can also be invoked with the 'start' after boot, for exmaple when a service is stopped and then manually restarted.

Is there a "standard", generic way for an init script to differentiate between the first run (at boot) and subsequent runs? (other than manual solutions such as creating a file on the first run and checking for it on subsequent runs)

4
  • I would be interested why you would differentiate these states? Jan 16, 2015 at 17:45
  • The script needs to do some startup checks that should only be done once, at boot time, but not once the system is running.
    – Grodriguez
    Jan 16, 2015 at 18:53
  • You could check the current runlevel Jan 16, 2015 at 19:25
  • I'm using busybox init -- no runlevels..
    – Grodriguez
    Jan 16, 2015 at 19:26

0

You must log in to answer this question.

Browse other questions tagged .