[root@dywOffice ~]# vi /etc/inittab # Default runlevel. The runlevels used by Mandrakelinux are: # 0 - halt (Do NOT set initdefault to this) # 1 - Single user mode # 2 - Multiuser, without NFS (The same as 3, if you do not have networking) # 3 - Full multiuser mode # 4 - unused # 5 - X11 # 6 - reboot (Do NOT set initdefault to this) # id:3:initdefault: # System initialization. si::sysinit:/etc/rc.d/rc.sysinit l0:0:wait:/etc/rc.d/rc 0 l1:1:wait:/etc/rc.d/rc 1 l2:2:wait:/etc/rc.d/rc 2 l3:3:wait:/etc/rc.d/rc 3 l4:4:wait:/etc/rc.d/rc 4 l5:5:wait:/etc/rc.d/rc 5 l6:6:wait:/etc/rc.d/rc 6 # Trap CTRL-ALT-DELETE ca::ctrlaltdel:/sbin/shutdown -t3 -r now # When our UPS tells us power has failed, assume we have a few minutes # of power left. Schedule a shutdown for 2 minutes from now. # This does, of course, assume you have powerd installed and your # UPS connected and working correctly. pf::powerfail:/sbin/shutdown -f -h +2 "Power Failure; System Shutting Down" # If power was restored before the shutdown kicked in, cancel it. pr:12345:powerokwait:/sbin/shutdown -c "Power Restored; Shutdown Cancelled" # Run gettys in standard runlevels 1:2345:respawn:/sbin/mingetty tty1 2:2345:respawn:/sbin/mingetty tty2 3:2345:respawn:/sbin/mingetty tty3 4:2345:respawn:/sbin/mingetty tty4 5:2345:respawn:/sbin/mingetty tty5 6:2345:respawn:/sbin/mingetty tty6 [root@dywOffice ~]# man inittab [設定項目]:[run level]:[init 的動作行為]:[指令項目] 1. 設定項目: 最多四個字元,代表 init 的主要工作項目,只是一個簡單的代表說明。 2. run level: 該項目在哪些 run level 底下進行的意思。如果是 35 則代表 runlevel 3 與 5 都會執行。 3. init 的動作項目: 主要可以進行的動作項目意義有: initdefault :代表預設的 run level 設定值; sysinit :代表系統初始化的動作項目; ctrlaltdel :代表 [ctrl]+[alt]+[del] 三個按鍵是否可以重新開機的設定; wait :代表後面接的指令項目必須要執行完畢才能繼續後面的動作; respawn :代表後面欄位的指令可以無限制的再生。 更多的設定項目請參考 man inittab 的說明。 4. 指令項目: 亦即應該可以進行的指令,通常是一些 script 囉。
[root@dywOffice ~]# ll /etc/rc.d/rc3.d total 0 lrwxrwxrwx 1 root root 12 Oct 17 13:11 K09dm -> ../init.d/dm* lrwxrwxrwx 1 root root 18 Oct 17 13:11 S03iptables -> ../init.d/iptables* lrwxrwxrwx 1 root root 14 Oct 17 13:11 S04acpi -> ../init.d/acpi* lrwxrwxrwx 1 root root 19 Oct 17 13:11 S05harddrake -> ../init.d/harddrake* lrwxrwxrwx 1 root root 17 Oct 17 13:11 S10network -> ../init.d/network* lrwxrwxrwx 1 root root 19 Dec 20 08:25 S11shorewall -> ../init.d/shorewall* lrwxrwxrwx 1 root root 16 Oct 17 13:11 S12syslog -> ../init.d/syslog* lrwxrwxrwx 1 root root 17 Oct 17 13:11 S13partmon -> ../init.d/partmon* ......................中間省略.................................. lrwxrwxrwx 1 root root 17 Oct 17 13:11 S95kheader -> ../init.d/kheader* lrwxrwxrwx 1 root root 16 Oct 17 13:11 S99devfsd -> ../init.d/devfsd* lrwxrwxrwx 1 root root 11 Oct 17 13:11 S99local -> ../rc.local*
start stop restart reload status 啟動服務 停止服務 重新啟動服務 重新載入服務 顯示服務狀態
# Run gettys in standard runlevels 1:2345:respawn:/sbin/mingetty tty1 2:2345:respawn:/sbin/mingetty tty2 3:2345:respawn:/sbin/mingetty tty3 4:2345:respawn:/sbin/mingetty tty4 5:2345:respawn:/sbin/mingetty tty5 6:2345:respawn:/sbin/mingetty tty6
F1 ~ F4
』有效。
[root@dywOffice ~]# ls /etc/sysconfig alsa i18n.bak printing* autofsck i18n.orig.gcin* rawdevices bootsplash init readonly-root clock* installkernel suspend console/ keyboard* suspend-scripts/ cpufreq modules/ syslog desktop* mouse* system dhcpd.rpmsave msec tmpwatch firstboot.rpmsave net_monitorrc* udev_net harddisks network* usb harddrake2/ networking/ userdrake i18n network-scripts/ xinetd
練習題