I am writing a init.d script that should run commands with certain options if it were being executed at system startup. The same script should run commands with other options if the user was manually executing the script.
For example, in a networking script, if it was being run at the system start up, then certain network interface would not be brought up depending on whether they should be configured ONBOOT. Otherwise, if the user was manually running the networking script (service network start), then all network interfaces would be brought up.
One way i can achieve this is to create a file say "/tmp/.boot" from the parent rc script, which is deleted after all startup scripts are executed. And then in the init script check of the existence of the file /tmp/.boot to determine if the script is being run as part of the startup sequence or not.
I was wondering if there is any existing way of knowing that the system is in its boot up sequence. Could something in /proc/ or elsewhere tell me that the system is in its boot sequence?
Looking forward to your suggestions.
Thanks and Regards ~Sameer