Linux Administration - Runlevels

Levels 0 - shutdown system (complte power down) 1,s,S - single user mode 2 - full multi-user mode [text] (Debian) 3 - full multi-user mode [text] (Fedora, Mandrake and Red Hat) 4 - undefined 5 - full multi-user mode [X] (Fedora, Mandrake, Red Hat, etc) 6 - reboot
Files /etc/inittab format: id:runlevels:action:process Once all entries in inittab for systems runlevel is executed, the boot process is complete.

/etc/init.d/rc /etc/init.d/rc.d /etc/rc.d SysV startup scripts are stored in these directories, depending on distribution.

Commands /etc/init.d/smd start Manually start the samba server.

[top] chkconfig

chkconfig --list [service] Lists the current services running and their runlevels. Specify a particular service to view the results for that service only.

chkconfig --level [levels 0-6] [service] [on/off/reset] > chkconfig --level 2345 [service] off Manipulate the current runlevels for a service.

chkconfig --add [service] After adding a startup script to the SysV startup directory, add start/stop links in runlevel directories. Make sure the comment lines in the script have the proper syntax for chkconfig's use.

chkconfig | grep -v off Check for all processes that are on.

[top] ntsysv (Red Hat, Fedora and Mandrake)

ntsysv [--level] [levels 0-6] Configure runlevels.
If no options specified the current runlevel will be managed.

[top] runlevel

> runlevel N 2 Display runlevel information.
The first field is the previous run level..
The second field is the current run level. "N" means the runlevel has not switched since boot.

[top] init / telinit

> init [runlevel] Change system runlevel.

> telinit [runlevel, q] Change system runlevel. Specify "q" if changes were made to /etc/inittab so it can be re-read.

> sync;sync; init 6 OR reboot Reboot but first flush buffers to hard disk

[top] service

> service --status-all | grep -v stopped Change system runlevel.

[top] shutdown

> shutdown now Change system runlevel to 1. Shutdown immediately!

> shutdown -r +5 "rebooting in 5 minutes" Reboot system in 5 minutes and display message

> shutdown -h +15 "shutting down in 15 minutes" Halt system in 15 minutes and display message.

> shutdown -c "shutdown cancelled" Cancel shutdown and display message.

[top] halt/reboot/poweroff

> halt Shutdown system.

> reboot Reboot system.

> poweroff Shutdown and power off system.