in my /etc/init.d/blabla script, which is the correct way to determine if the system is booting or the user root is runnig the script ?
I am thinking about * parent pid * euid * terminal... pts ?
in my /etc/init.d/blabla script, which is the correct way to determine if the system is booting or the user root is runnig the script ?
I am thinking about * parent pid * euid * terminal... pts ?
On traditional init (not systemd), your script would have
$0
as something likeSxxblabla
when run by init, wherexx
are two digits.When run by a user, there are usually a lot of environment variables set, like
USER
,HOME
, and so on that are not set when running from init.Note that in general, you want the effect of running the command in the shell and running the command at startup to be as identical as possible. Otherwise it may test fine from the command line but file when you boot.