advertisement
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
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Related manuals
advertisement
Table of contents
- 8 I. process management
- 10 1. introduction to processes
- 11 1.1. terminology
- 12 1.2. basic process management
- 16 1.3. signalling processes
- 19 1.4. practice : basic process management
- 20 1.5. solution : basic process management
- 22 2. process priorities
- 23 2.1. priority and nice values
- 26 2.2. practice : process priorities
- 27 2.3. solution : process priorities
- 29 3. background jobs
- 30 3.1. background processes
- 32 3.2. practice : background processes
- 33 3.3. solution : background processes
- 35 II. disk management
- 38 4. disk devices
- 39 4.1. terminology
- 41 4.2. device naming
- 42 4.3. discovering disk devices
- 47 4.4. erasing a hard disk
- 48 4.5. advanced hard disk settings
- 49 4.6. practice: hard disk devices
- 50 4.7. solution: hard disk devices
- 52 5. disk partitions
- 53 5.1. about partitions
- 54 5.2. discovering partitions
- 56 5.3. partitioning new disks
- 58 5.4. about the partition table
- 59 5.5. practice: partitions
- 60 5.6. solution: partitions
- 61 6. file systems
- 62 6.1. about file systems
- 63 6.2. common file systems
- 66 6.3. putting a file system on a partition
- 67 6.4. tuning a file system
- 68 6.5. checking a file system
- 69 6.6. practice: file systems
- 70 6.7. solution: file systems
- 71 7. mounting
- 72 7.1. mounting local file systems
- 73 7.2. displaying mounted file systems
- 75 7.3. from start to finish
- 76 7.4. permanent mounts
- 77 7.5. securing mounts
- 78 7.6. mounting remote file systems
- 79 7.7. practice: mounting file systems
- 80 7.8. solution: mounting file systems
- 82 8. troubleshooting tools
- 83 8.1. lsof
- 84 8.2. fuser
- 85 8.3. chroot
- 86 8.4. iostat
- 86 8.5. iotop
- 87 8.6. practice: troubleshooting tools
- 36 8.7. solution: troubleshooting tools
- 37 9. introduction to uuid's
- 38 9.1. about unique objects
- 38 9.2. tune2fs
- 38 9.3. uuid
- 39 9.4. uuid in /etc/fstab
- 40 9.5. uuid as a boot device
- 41 9.6. practice: uuid and filesystems
- 42 9.7. solution: uuid and filesystems
- 43 10. introduction to raid
- 43 10.1. hardware or software
- 44 10.2. raid levels
- 46 10.3. building a software raid5 array
- 49 10.4. practice: raid
- 50 10.5. solution: raid
- 51 11. logical volume management
- 52 11.1. introduction to lvm
- 53 11.2. lvm terminology
- 54 11.3. example: using lvm
- 56 11.4. example: extend a logical volume
- 58 11.5. example: resize a physical Volume
- 60 11.6. example: mirror a logical volume
- 61 11.7. example: snapshot a logical volume
- 62 11.8. verifying existing physical volumes
- 64 11.9. verifying existing volume groups
- 65 11.10. verifying existing logical volumes
- 66 11.11. manage physical volumes
- 68 11.12. manage volume groups
- 70 11.13. manage logical volumes
- 72 11.14. practice : lvm
- 73 11.15. solution : lvm
- 77 12. iSCSI devices
- 78 12.1. iSCSI terminology
- 78 12.2. iSCSI Target in RHEL/CentOS
- 80 12.3. iSCSI Initiator in RHEL/CentOS
- 82 12.4. iSCSI target on Debian
- 83 12.5. iSCSI target setup with dd files
- 85 12.6. ISCSI initiator on ubuntu
- 87 12.7. using iSCSI devices
- 88 12.8. practice: iSCSI devices
- 89 12.9. solution: iSCSI devices
- 90 13. introduction to multipathing
- 91 13.1. install multipath
- 91 13.2. configure multipath
- 92 13.3. network
- 92 13.4. start multipathd and iscsi
- 94 13.5. multipath list
- 95 13.6. using the device
- 96 13.7. practice: multipathing
- 97 13.8. solution: multipathing
- 99 III. boot management
- 101 14. bootloader
- 102 14.1. boot terminology
- 105 14.2. grub
- 110 14.3. grub
- 111 14.4. lilo
- 112 14.5. practice: bootloader
- 113 14.6. solution: bootloader
- 153 15. init and runlevels
- 154 15.1. system init(ialization)
- 159 15.2. daemon or demon ?
- 159 15.3. starting and stopping daemons
- 160 15.4. chkconfig
- 162 15.5. update-rc.d
- 163 15.6. bum
- 164 15.7. runlevels
- 166 15.8. systemd
- 166 15.9. other systemd tools
- 168 15.10. practice: init
- 169 15.11. solution : init
- 171 IV. system management
- 173 16. scheduling
- 174 16.1. one time jobs with at
- 176 16.2. cron
- 178 16.3. practice : scheduling
- 179 16.4. solution : scheduling
- 180 17. logging
- 181 17.1. login logging
- 184 17.2. syslogd
- 187 17.3. logger
- 187 17.4. watching logs
- 188 17.5. rotating logs
- 189 17.6. practice : logging
- 190 17.7. solution : logging
- 192 18. memory management
- 193 18.1. displaying memory and cache
- 194 18.2. managing swap space
- 196 18.3. monitoring memory with vmstat
- 197 18.4. practice : memory
- 198 18.5. solution : memory
- 199 19. monitoring
- 200 19.1. top
- 200 19.2. free
- 201 19.3. watch
- 201 19.4. vmstat
- 202 19.5. iostat
- 203 19.6. mpstat
- 203 19.7. sadc and sar
- 204 19.8. ntop
- 204 19.9. iftop
- 204 19.10. iptraf
- 205 19.11. nmon
- 205 19.12. htop
- 206 20. RPM package management
- 207 20.1. package terminology
- 209 20.2. deb package management
- 211 20.3. apt-get
- 214 20.4. aptitude
- 215 20.5. apt
- 216 20.6. rpm
- 218 20.7. yum
- 225 20.8. alien
- 226 20.9. downloading software outside the repository
- 226 20.10. compiling software
- 227 20.11. practice: RPM package management
- 228 20.12. solution: RPM package management
- 194 V. network management
- 197 21. general networking
- 198 21.1. network layers
- 201 21.2. unicast, multicast, broadcast, anycast
- 203 21.3. lan-wan-man
- 205 21.4. internet - intranet - extranet
- 206 21.5. tcp/ip
- 207 22. interface configuration
- 208 22.1. to gui or not to gui
- 209 22.2. Debian/Ubuntu nic configuration
- 211 22.3. Red Hat/Fedora nic configuration
- 213 22.4. ifconfig
- 215 22.5. hostname
- 216 22.6. arp
- 217 22.7. route
- 217 22.8. ping
- 218 22.9. optional: ethtool
- 219 22.10. practice: interface configuration
- 220 22.11. solution: interface configuration
- 222 23. network sniffing
- 223 23.1. wireshark
- 225 23.2. tcpdump
- 226 23.3. practice: network sniffing
- 227 23.4. solution: network sniffing
- 228 24. binding and bonding
- 229 24.1. binding on Redhat/Fedora
- 230 24.2. binding on Debian/Ubuntu
- 231 24.3. bonding on Redhat/Fedora
- 233 24.4. bonding on Debian/Ubuntu
- 235 24.5. practice: binding and bonding
- 236 24.6. solution: binding and bonding
- 237 25. ssh client and server
- 238 25.1. about ssh
- 240 25.2. log on to a remote server
- 240 25.3. executing a command in remote
- 241 25.4. scp
- 242 25.5. setting up passwordless ssh
- 243 25.6. X forwarding via ssh
- 244 25.7. troubleshooting ssh
- 245 25.8. sshd
- 245 25.9. sshd keys
- 245 25.10. ssh-agent
- 246 25.11. practice: ssh
- 247 25.12. solution: ssh
- 249 26. introduction to nfs
- 250 26.1. nfs protocol versions
- 250 26.2. rpcinfo
- 251 26.3. server configuration
- 251 26.4. /etc/exports
- 251 26.5. exportfs
- 252 26.6. client configuration
- 253 26.7. practice: introduction to nfs
- 254 27. introduction to networking
- 255 27.1. introduction to iptables
- 256 27.2. practice : iptables
- 257 27.3. solution : iptables
- 258 27.4. xinetd and inetd
- 260 27.5. practice : inetd and xinetd
- 309 27.6. network file system
- 311 27.7. practice : network file system
- 312 VI. kernel management
- 314 28. the Linux kernel
- 315 28.1. about the Linux kernel
- 318 28.2. Linux kernel source
- 322 28.3. kernel boot files
- 324 28.4. Linux kernel modules
- 329 28.5. compiling a kernel
- 332 28.6. compiling one module
- 334 29. library management
- 335 29.1. introduction
- 335 29.2. /lib and /usr/lib
- 335 29.3. ldd
- 336 29.4. ltrace
- 336 29.5. dpkg -S and debsums
- 337 29.6. rpm -qf and rpm -V
- 338 29.7. tracing with strace
- 339 VII. backup management
- 341 30. backup
- 341 30.1. About tape devices
- 342 30.2. Compression
- 342 30.3. tar
- 344 30.4. Backup Types
- 345 30.5. dump and restore
- 345 30.6. cpio
- 346 30.7. dd
- 347 30.8. split
- 347 30.9. practice: backup
- 349 VIII. Appendices
- 351 A. disk quotas
- 351 A.1. About Disk Quotas
- 351 A.2. Practice Disk quotas
- 352 B. introduction to vnc
- 352 B.1. About VNC
- 352 B.2. VNC Server
- 352 B.3. VNC Client
- 353 B.4. Practice VNC
- 354 C. License
- 361 Index