增加启动控制脚本 1.Identify the run level for the service 2.Determine which services are needed by the new process 3.Change to /etc/rc#.d and identify startup script 4.Repeat the process for the directory containing the shutdown script 5.Create the startup (shutdown) script in /etc/init.d 6.Create hard links to appropriate /etc/rc#.d directories 7.test
# init 0 INIT: New run level: 0 The system is coming down. Please wait. System services are now being stopped. Print services stopped. Stopping the syslog service. syslogd: going down on signal 15 Aug 14 14:54:30 snmpdx: received signal 15 The system is down. syncing file systems... done Program terminated Type help for more information ok
shutdown 用于改变操作系统运行级别。 命令格式: shutdown [ -y ] [ -g seconds ] [ -i init-state ] [message] 选项: y 系统提示时默认回答为YES g 过多长时间改变 i 想要的运行级别 message 给所有登录用户的信息
# shutdown -y -g 0 -i 0 Shutdown started. Mon Dec 15 15:13:57 PST 1997 Broadcast Message from root (console) on mcmurdo Mon Dec 15 15:13:57... THE SYSTEM IS BEING SHUT DOWN NOW ! ! ! Log off now or risk your files being damaged Changing to init state 0 - please wait ok