On 06/13/2018 05:01 PM, Matias Fonzo wrote: > According to init(8): > > [..] > > ENVIRONMENT > Init sets the following environment variables for all its children: > > RUNLEVEL > The current system runlevel. > [..] > > Probably there is no need to write/read such file... >
While that is true, in this case reboot/halt would not be a direct child of init. If you have a shell open and run "echo $RUNLEVEL" you will probably find the variable is not set, unless your shell is a direct descendant of init. That is why I think having the value stored in a specific, non-volatile location.