Today to optimize the company's new deployment servers, found that the TTY terminal has 6, in order to save a bit of memory, decided to leave only a TTY terminal, the others are off, but CENTOS6 and centos5 terminal closure method completely changed, and I am also lazy, do not want a set of a Taiwan, Writing down this foot would have saved time.
System: CentOS 6
Close TTY Terminal script:
Cat pkill.sh
Copy Code code as follows:
#!/bin/bash
Sed-i ' s/\/dev\/tty\[1-6\]/\/dev\/tty\[1-1\]/g '/etc/init/start-ttys.conf
Sed-i ' s/\/dev\/tty\[1-6\]/\/dev\/tty\[1-1\]/g '/etc/sysconfig/init
Ttypid= ' PS auxw|grep tty|grep-v grep |grep tty[2-6]|awk ' {print $NF} '
For i in $ttypid;d o initctl stop tty tty= $i;d One
To execute permissions after saving:
Copy Code code as follows:
chmod +x pkill.sh
The script is very simple, before you use the best to determine their own system, to avoid unnecessary errors.