[prog] check if script parent process is "init"

Dominik Schramm dominik.schramm at gmxpro.net
Tue Apr 13 10:56:23 EST 2004


Hi list,

I'd like to check in a Bash script if it is being run by init,
i.e. directly upon system startup, and not interactively
or from another process -- say, cron.

I tried with looking at $PPID, but this variable seems undefined
when init started the script. This makes me really sad because
it would be such an elegant solution.

Is there another way than interpreting the ps output?

regards,
dominik



More information about the Programming mailing list