Linux服务器监控系统scout_add_login.sh
#!/bin/sh ########################################## ## ## ## 服务器监控系统(自动追加部分) ## ## ## ## 版本号:1.0.0 ## ## ## ## 程序:周杰 ## ## ## ## 版权所有:武汉卓杰教育网络科技有限公司 ## ## ## ## 日期:2002年3月 ## ## ## ########################################## ####################定义环境变量#################### WORK_PATH="/usr/local/sbin/scout" BASH_PRO_PATH="/root/.bash_profile" SCOUT_LOGIN_PATH=$WORK_PATH"/scout_login.sh" ####################定义环境变量#################### ####################自动在启动文件中追加一段代码#################### if [ ! -f $BASH_PRO_PATH ] then clear echo "" echo "FILE "$BASH_PRO_PATH" NOT FOUND! EXIT!" echo "" exit 1 fi if [ ! -f $SCOUT_LOGIN_PATH ] then clear echo "" echo "FILE "$SCOUT_LOGIN_PATH" NOT FOUND! EXIT!" echo "" exit 1 fi clear sign_num=0 scout_sign="" while read scout_sign do if [ "$scout_sign" = "#auto_scout_sign#" ] then sign_num=1 break fi done < "$BASH_PRO_PATH" if [ $sign_num -eq 0 ] then echo "">>$BASH_PRO_PATH echo '#auto_scout_sign#'>>$BASH_PRO_PATH echo "if [ -f $SCOUT_LOGIN_PATH ]; then">>$BASH_PRO_PATH echo "$SCOUT_LOGIN_PATH">>$BASH_PRO_PATH echo "fi">>$BASH_PRO_PATH echo "">>$BASH_PRO_PATH clear echo "" echo "ADD FILE "$BASH_PRO_PATH" SUCCEED! " echo "" exit 0 else clear echo "" echo "FILE "$BASH_PRO_PATH" ADD BEING! " echo "" exit 0 fi exit 0 ####################自动在启动文件中追加一段代码####################