快速设置Linux超时退出脚本

At 2010-12-06

转载请注明文章转载自:Dbabc.Net [http://dbabc.net]
本文链接:http://dbabc.net/archives/2010/12/06/linux-tmout-profile-shell.shtml

负责20+台Linux下的DB,出于某种原因,要将Linux设置为超时10分钟自动退出,设置很简单,但是架不住机器多啊,要每台都要检查/etc/profile文件。还好有shell脚本,可以进行简化操作,一下是自己搞的一个脚本。

#!/bin/bash
# Auto add TMOUT=600 to profile
# by Dbabc.Net@2010-12-06

ROOT_UID=0
TM=`cat /etc/profile |grep TMOUT= |wc -l`

if [ "$UID" -ne "$ROOT_UID" ]
then
echo "You must be root to run this script."
exit
fi

a=$TM
if [ "$a" = 0 ]
then
cat >> /etc/profile <<EOF
TMOUT=600
EOF
echo "Add TMOUT=600 to profile ok"

else
echo "TMOUT=600 io profile alredy ok"
fi
exit 0

无觅相关文章插件,快速提升流量

Copyright © Dbabc.Net All Rights Reserved. 本站内容仅代表个人观点, 与其他任何组织或公司无关

-The End-

发表评论


*

为你保密









Copyright © Dbabc.Net All Rights Reserved. 本站内容仅代表个人观点, 与其他任何组织或公司无关

Powered by Wordpress and Theme by WPYOU