On Jan 7, 2004, at 14:55, Stephen Gran wrote:
This one time, at band camp, Anthony DeRobertis said:/etc/init.d/rc and /etc/init.d/rcS. Look in the /etc/inittab file. I'm pretty sure this means PPID != 1.Yes, I was working with two variants: [ -n "$RUN_package_AT_BOOT" -a "$PPID" = "1" ] || exit 0 and if [ -z "$RUN_package_AT_BOOT" -o "$PPID" != "1" ] ; then exit 0 ; fi
I should of been clearer: I don't think scripts run at boot are guaranteed that PPID = 1. That is because init (pid = 1) invokes /etc/init.d/rc (pid = ?) which then invokes /etc/rcX.d/YYYYY (pid = ?).
Although I haven't rebooted a machine to test, I bet: #!/bin/sh echo "PPID = $PPID" as /etc/init.d/test-ppid and installed with update-rc.d would NOT echo PPID = 1but rather some number that would be repeatable (unless you have random PIDs), but very machine dependent.
And even if $PPID is 1, that's quite fragile.