I have inherited instructions that say to get to single-user mode on Solaris like:
reboot -- -s
- Mount all file systems
My question is, why not just do:
What's the difference?
David, run-levels 1 and s are equivalent. The main difference between these two commands is that reboot will reset the system, bringing it up in as clean a state as possible, while "init s" will just go down to single user without resetting the system - this is possibly quicker, but potentially may leave "cruft" around (any processes lacking an utmpx entry may not get shut down, etc.).
There are some minor differences in that "init s" will not have had any boot or bootwait entries in /etc/inittab run, but that's somewhat unlikely.
Michael, you're incorrect that init doesn't understand SMF (the svcadm stuff); it does.
xenny, the key to the -s flag is the "--" immediately following the reboot command. This indicates that anything following "--" should get passed directly to the boot loader and kernel - see the boot_arguments section in the reboot manpage.
I believe 'init 1' would not set a system into single user mode.....you'd have to use
If that edit is made to your statement, then there is a lot of difference. The reboot command, will basically take the system all the way down and then start it from ground zero into single user mode.
A simple init X will only run the scripts to transition a system into the requested state X. The selection of startup/shutdown scripting differs between UNIX type systems and Linux type systems. A reboot does not happen (exceptions for transitions to states 0 and 6, of course).
reboot will restart the kernel. init should take the machine to single user mode, killing processes as it goes to arrive at single user mode without restarting the kernel.
On my handy solaris box, the man page for /usr/sbin/reboot gives possible parameters of d l n or q , which reboot that takes 's' is in your path first?