Running init not from console?

John Fenk fenk at sequent.UUCP
Tue Feb 5 07:34:48 AEST 1991


In article <1991Feb1.071518.6219 at apt.bungi.com> brian at apt.bungi.com (Brian Litzinger) writes:
>I have this wonderful Elgar backup power supply that can tell
>my UNIX System (ISC 2.0.2 System V.3.2) that the power has
>gone out.
>
>So I'd like some daemon to do an '/etc/init 0' when this happens.
>
>I've written a daemon called 'pwatchd' which does just this when
>it is sure the power is out.  However, 'init' just says:
>
>    init must be run from the console
>
>So what do I have to do to get init to do what I want rather
>than what it thinks is best?

There have been several suggestions regarding this question. Someone suggested
using shutdown. Some systems require shutdown to be run from the console.
Someone else suggested using the haltsys command. I would not suggest using
haltsys (on the systems that have it) except in an emergency. On the systems
that I am familiar with haltsys does not unmount filesystems and do other
cleanups before shutting down. I suggest:

	/etc/init 0 </dev/console

This should fool init into thinking it is running from the console. It has
worked for me on several different systems. You could also just send the right
signal to the init process, but why bother figuring out what that is when
a command has been provided for the purpose.

John Fenk
Sequent Computer Systems, Inc.
fenk at sequent.com



More information about the Comp.unix.questions mailing list