scplt封锁检查脚本

scplt封锁检查脚本


#!/bin/bash

# Author:royoy
# Version:v0.0.1
# Date:03/2016
# Desc:scplt createlock check script

#lock_id=("createlock_xx_php_1" "createlock_xx_php_3" "createlock_xx_php_5" "createlock_xx_php_6" "createlock_xx_php_7" "createlock_xx_php_8" "createlock_xx_php_9" "createlock_xx_php_11" "createlock_xx_php_12" "createlock_xx_php_13" "createlock_xx_php_14" "createlock_xx_php_15" "createlock_xx_php_19")
#lock_id=("createlock_xx_php_1" "createlock_xx_php_3" "createlock_xx_php_5" "createlock_xx_php_6" "createlock_xx_php_7" "createlock_xx_php_8" "createlock_xx_php_9" "createlock_xx_php_10" "createlock_xx_php_11" "createlock_xx_php_12" "createlock_xx_php_13" "createlock_xx_php_14" "createlock_xx_php_15")


lock_id=("createlock_xx_php_1" "createlock_xx_php_5" "createlock_xx_php_6" "createlock_xx_php_7" "createlock_xx_php_8" "createlock_xx_php_9" "createlock_xx_php_11" "createlock_xx_php_12" "createlock_xx_php_13" "createlock_xx_php_14" "createlock_xx_php_15" "createlock_xx_php_19" "createlock_xx_php_24" "createlock_xx_php_25")


date_f=`date +%Y-%m-%d`

Path="/data/app_cli_log/highadmin/"

file="/tmp/createlock.txt"

name_ok="OK_108_scplt_CHECK_CREATELOCK_TIME"

name_error="ERROR_108_scplt_CHECK_CREATELOCK_TIME"

mail_ok(){
        echo "$name_ok" | mail -s "$name_ok" admin@weststarinc.co
        }

mail_error(){
        uuencode /tmp/createlock.txt error.txt | mail -s "$name_error" admin@weststarinc.co
        }


for ((i=0;i<=13;i++));do

	echo "#############################################">>$file
        echo "start check ${lock_id[$i]} lock time...">>$file
        echo "`cat $Path${lock_id[$i]} | grep "$date_f"`">>$file

done

result=`cat $file`

num=`cat $file | grep "Lock tables were created" | wc -l`

#if [ $num == 27 ];then
if [ $num == 29 ];then

        mail_ok
else
	mail_error
fi

rm -f $file