相关命令
shutdown 命令
/sbin/shutdown -t3 -r now #延迟3秒重启系统
-
-c:当执行“shutdown -h 11:50”指令时,只要按+键就可以中断关机的指令;
-
-f:重新启动时不执行fsck;
-
-F:重新启动时执行fsck;
-
-h:将系统关机;
-
-k:只是送出信息给所有用户,但不会实际关机;
-
-n:不调用init程序进行关机,而由shutdown自己进行;
-
-r:shutdown之后重新启动;
-
-t<秒数>:送出警告信息和删除信息之间要延迟多少秒
CentOS操作系统只要按下Ctrl+Alt+Del快捷键,系统就会自动重启,如果数据正在写入,无意间按下Ctrl+Alt+Del快捷键,
不会有任何确认,系统就会直接重启,这样会造成很多麻烦,所以要关闭Ctrl+Alt+Del快捷键,以防系统重启
CentOS5.x关闭方式
要将Ctrl+Alt+Del快捷键关闭,需要编辑/etc/inittab文件,编辑完成后,必须重启,此后不管怎样按Ctrl+Alt+Del快捷键系统都不会重启了
-
[root@localhost ~]# vi /etc/inittab
-
#Trap CTRO-ALT-DELETE
-
#ca::ctrlaltdel:/sbin/shutdown -t3 -r now //默认启用,加上# 注释掉
CentOS6.x关闭方式
打开inittab文件
-
[root@localhost ~]# vi /etc/inittab
文件内容跟CentOS5.x不一样
-
#
-
# ADDING OTHER CONFIGURATION HERE WILL HAVE NO EFFECT ON YOUR SYSTEM.
-
#
-
# System initialization is started by /etc/init/rcS.conf
-
#
-
# Individual runlevels are started by /etc/init/rc.conf
-
#
-
# Ctrl-Alt-Delete is handled by /etc/init/control-alt-delete.conf
-
#
-
# Terminal gettys are handled by /etc/init/tty.conf and /etc/init/serial.conf,
-
# with configuration in /etc/sysconfig/init.
由上面红色那行得知,需要修改control-alt-delete.conf
control-alt-delete.conf文件只有CentOS6.x才有,CentOS5.x是没有的
-
1 # control-alt-delete - emergency keypress handling
-
2 #
-
3 # This task is run whenever the Control-Alt-Delete key combination is
-
4 # pressed. Usually used to shut down the machine.
-
5
-
6 start on control-alt-delete
-
7
-
8 #exec /sbin/shutdown -r now "Control-Alt-Delete pressed"
注释掉这一行就可以了
#exec /sbin/shutdown -r now "Control-Alt-Delete pressed"
重启系统使生效!
现在按Ctrl+Alt+Del快捷键就不会重启了
阅读(2290) | 评论(0) | 转发(0) |