Operating System - Tru64 Unix
1751791 Members
5222 Online
108781 Solutions
New Discussion юеВ

Re: init s and rc0 script

 
Michal Bizik
New Member

init s and rc0 script

Greetings,

I am new on tru64 system, i started to look around a bit and stoped by rc0 script wich is doing all the job during the system shutdown. One thing i just can't get is that in inittab the single user mode is deffined as:

ss:Ss:wait:/sbin/rc0 shutdown < /dev/console > /dev/console 2>&1

but then when i open rc0 the end of this script is like:

if [ "$ARGONE" = shutdown ]; then
/sbin/init S
else
echo "The system is down."
sync
/sbin/halt -q

so its calling the "init S" command again and thats very strange. How is it possible that this sequence doesn't loop the whole system into executing "rc0 shutdown" again and again...? i see no other condition in the script wich could block the loop...

Thank you
4 REPLIES 4
Michal Bizik
New Member

Re: init s and rc0 script

no one knows the answer?

Could you guys atleast tell me whats the line

/sbin/kill -USR1 $SPECIALPID

doing?

It looks like it sends USR1 signal to the init process. But what does it mean for the init?
How is init interpreting the USR1 signal?
Dennis Handly
Acclaimed Contributor

Re: init s and rc0 script

>I see no other condition in the script wich could block the loop.

On HP-UX, you only execute the rc0 scripts if you transition to that runlevel. Not if you are already at that runlevel.

>It looks like it sends USR1 signal to the init process. But what does it mean for the init?

Yes, it sends USR1 to $SPECIALPID.
You'll need to look at the documentation for init(8).
Unfortunately I don't see anything obvious:
http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/V50_HTML/MAN/MAN8/0166____.HTM
http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/V50_HTML/MAN/MAN1/0237____.HTM
Michal Bizik
New Member

Re: init s and rc0 script

Yeah thats why im asking. Coz init man pages shows nothing about this signal :/

Its obvios that init do not load rc0 again when the system is in single user already. But where is the condition?
Matti_Kurkela
Honored Contributor

Re: init s and rc0 script

The inittab line that runs /sbin/rc0 is of type "wait". That means it is run only once when entering runlevel S or s. It is not run again as long as the system stays in the single-user runlevel.

So, running "init S" would cause the main init process to "think" something like "OK, we're already in single-user mode and we already did /sbin/rc0, so there is nothing at all to do."

The point of having "/sbin/init S" instead of just exiting the script is mysterious to me: perhaps some side-effect of re-executing /sbin/init is desired? (It might be triggering the main init process to re-read the inittab file, in case it's been changed; perhaps this is for firmware updates or some other thing that requires system to automatically go to single-user mode, do something and return to normal mode.)

At that point, the single-user shell (or root login prompt, if single-user mode can be password-protected in tru64) is invoked, most likely by program code embedded in /sbin/init itself. That is likely to be the same code that gets executed if you are booting a system whose inittab file has accidentally become empty or deleted.

The only way to know for sure would be to read the source code of /sbin/init.

MK
MK