Sunday, January 11, 2009

FreeBSD|shutdown -h now

shutdown now will not shutdown freebsd but enter into single user mode, to shutdown, use shutdown -h now

howzit

use cmd like this shutdown -h now h means halt. I guess it is a way to take into single user mode without restarting the box compltely.

chow

HOWT0: Go from single-user to multi-user
Miscellaneous Posted by Jason on Sunday May 12, @09:52AM
from the dept.
As many of you may already know, UNIX is separated into two main camps. The BSD camp and the system V camp. System V Unix OS's have many run levels which they can run in and each level starts up different services. On the other hand, BSD(FreeBSD included) has only two: single-user and multi-user mode. Also, you can switch between these two modes without a reboot. Here's how...

For this to work, you have to start FreeBSD in single-user mode, after that you can switch to multi-user mode and back to singe-user mode without rebooting.


[Boot in single user mode]

As the operating system is starting, it will display the following message:

Hit [Enter] to boot immediately, or any other key for command prompt.

Booting [kernel] in 10 seconds...


You should now press the space bar, and you will see the following message:

Type '?' for a list of commands, or 'help' for more detailed help.

ok


Now type boot -s and press the enter key to start FreeBSD in single user mode. After the system boots, you should see the statement:

Enter full pathname of shell or RETURN for /bin/sh:

Press the enter key and you will have a # prompt.


[Mount the filesystems]

Next, you will have to mount your filesystems manually. At the command prompt, issue the mount command. This command will mount all the filesystems listed in your /etc/fstab file. You may also wish to enable your swap.

# mount -t ufs -a
# swapon -a


[Switch to multi-user mode]

At the command prompt, issue the exit command. This command will run your normal startup scripts and start FreeBSD in multi-user mode.

# exit


[Switch back to single-user mode]

At the command prompt, issue the shutdown now command. This will not shutdown the computer, but instead will drop you back to single-user mode.

# shutdown now



[Shutting down]

To shutdown the OS in either single-user or multi-user mode, issue the halt command:

# halt



To learn more about the commands listed in this post please refer to the man pages.

man mount
man swapon
man shutdown
man halt


< | >



Re: HOWT0: Go from single-user to multi-user
by ATorres on Friday April 18, @10:36AM
Good day, Please excuse my ignorance. I'm a DOS/Windows guy. How can I setup BSD to execute an application program after boot (just like Autoexec.bat in DOS) automatically? In the same line, is there a way to setup BSD so that it doesn't ask me for a user name to login? Again, imitating my DOS computer, I'd like to turn on the computer and the system would boot and run an application. Thanks much.
[ Add a Reply to this ]
  • No user and password prompt
    by Doug on Wednesday July 13, @09:43AM
    You could install a "display manager" like xdm or kdm or gdm if you want to get to a pretty login screen. I believe that kdm will do auto-login if you set it up properly.
    [ Reply to this ]
Re: HOWT0: Go from single-user to multi-user
by Gary on Saturday June 14, @02:31PM
add a line to /etc/rc.local or a script to /usr/local/etc/rc.d

No comments: