#!/bin/bash
echo "cd $JENKINS_HOME/jobs/$JOB_BASE_NAME/builds/${BUILD_NUMBER}"
cd $JENKINS_HOME/jobs/$JOB_BASE_NAME/builds/${BUILD_NUMBER}
echo ---

function grep_key_word()
{
	grep -B $2 "$1" log
	if [ $? = 0 ];then
		echo ---
		exit -1
	fi
}

grep_key_word "No space left on device" 1
grep_key_word "Got error: [0-9]\{4\}:" 1
#grep_key_word "ERROR [0-9]\{4\} " 1
grep_key_word "Can't connect to MySQL server" 1
grep_key_word "show tables failed" 3
#grep_key_word "EXEC_SQL_FAIELD Error [0-9]\{4\}" 1
grep_key_word "mysqldump: Couldn't execute" 2

echo "post_build_script_sync_db finish~"
