#!/bin/bash
source /OSM/script/os_load_base.sh

function PATCH_START()
{
	sqlite3 /OSM/conf/alarm_config.dat ".timeout 10000" "UPDATE alarmdefine_cn set AlmType=2,AlmLevel=5 WHERE AlmID=35248799219799"
	sqlite3 /OSM/conf/alarm_config.dat ".timeout 10000" "UPDATE alarmdefine_en set AlmType=2,AlmLevel=5 WHERE AlmID=35248799219799"
	sqlite3 /OSM/conf/alarm_config.dat ".timeout 10000" "UPDATE alarmdefine_cn set AlmType=2,AlmLevel=5 WHERE AlmID=17657689145370"
	sqlite3 /OSM/conf/alarm_config.dat ".timeout 10000" "UPDATE alarmdefine_en set AlmType=2,AlmLevel=5 WHERE AlmID=17657689145370"
	killall alarm
    return 
}

function PATCH_END()
{
    return
}

function PATCH_ROLLSTART()
{
	sqlite3 /OSM/conf/alarm_config.dat ".timeout 10000" "UPDATE alarmdefine_cn set AlmType=4,AlmLevel=2 WHERE AlmID=35248799219799"
	sqlite3 /OSM/conf/alarm_config.dat ".timeout 10000" "UPDATE alarmdefine_en set AlmType=4,AlmLevel=2 WHERE AlmID=35248799219799"
	sqlite3 /OSM/conf/alarm_config.dat ".timeout 10000" "UPDATE alarmdefine_cn set AlmType=4,AlmLevel=2 WHERE AlmID=17657689145370"
	sqlite3 /OSM/conf/alarm_config.dat ".timeout 10000" "UPDATE alarmdefine_en set AlmType=4,AlmLevel=2 WHERE AlmID=17657689145370"
	killall alarm
    return
}

function PATCH_ROLLEND()
{
	return
}

#start：打补丁前需要执行的操作，脚本的执行时间点在替换文件前
#end：打补丁后需要执行的操作，脚本的执行时间点在替换文件后
#rollstart：回滚补丁时需要执行的操作，脚本的执行时间点在文件被恢复之前。
#rollend：回滚补丁时需要执行的操作，脚本的执行时间点在文件被恢复之后。

L_CMD=$1
OS_echo "command is $L_CMD"
case $L_CMD in
        "start") 
                PATCH_START
                ;;
        "end") 
                PATCH_END
                ;;
        "rollstart") 
                PATCH_ROLLSTART
                ;;
        "rollend") 
                PATCH_ROLLEND
                ;;
        *)
                OS_echo  "unsupported option."
esac
exit 0

