Linux System Administration - X

Add to my manuals
368 Pages

advertisement

Linux System Administration - X | Manualzz

init and runlevels

When in runlevel 0 or 6 halt, reboot and poweroff will tell the kernel to halt, reboot or

poweroff the system.

When not in runlevel 0 or 6, typing reboot as root actually calls the shutdown command with the -r switch and typing poweroff will switch off the power when halting the system.

15.7.5. /var/log/wtmp

halt, reboot and poweroff all write to /var/log/wtmp. To look at /var/log/wtmp, we need to use th last.

[root@RHEL52 ~]# last | grep reboot reboot system boot 2.6.18-128.el5 Fri May 29 11:44 (192+05:01) reboot system boot 2.6.18-128.el5 Wed May 27 12:10 (06:49) reboot system boot 2.6.18-128.el5 Mon May 25 19:34 (1+15:59) reboot system boot 2.6.18-128.el5 Mon Feb 9 13:20 (106+21:13)

15.7.6. Ctrl-Alt-Del

When rc is finished starting all those scripts, init will continue to read /etc/inittab. The next line is about what to do when the user hits Ctrl-Alt-Delete on the keyboard.

Here is what Debian 4.0 does.

root@barry:~# grep -i ctrl /etc/inittab

# What to do when CTRL-ALT-DEL is pressed.

ca:12345:ctrlaltdel:/sbin/shutdown -t1 -a -r now

Which is very similar to the default Red Hat Enterprise Linux 5.2 action.

[root@RHEL52 ~]# grep -i ctrl /etc/inittab

# Trap CTRL-ALT-DELETE ca::ctrlaltdel:/sbin/shutdown -t3 -r now

One noticable difference is that Debian forces shutdown to use /etc/shutdown.allow, where

Red Hat allows everyone to invoke shutdown pressing Ctrl-Alt-Delete.

15.7.7. UPS and loss of power

[root@RHEL52 ~]# grep ^p /etc/inittab pf::powerfail:/sbin/shutdown -f -h +2 "Power Failure; System Shutting Down" pr:12345:powerokwait:/sbin/shutdown -c "Power Restored; Shutdown Cancelled"

It will read commands on what to execute in case of powerfailure, powerok and Ctrl-Alt-

Delete. The init process never stops keeping an eye on power failures and that triple key combo.

root@barry:~# grep ^p /etc/inittab pf::powerwait:/etc/init.d/powerfail start pn::powerfailnow:/etc/init.d/powerfail now po::powerokwait:/etc/init.d/powerfail stop

171

advertisement

Was this manual useful for you? Yes No
Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Related manuals

Download PDF

advertisement

Table of contents