#!/bin/bash
otrPad="          "

origin_65431207943_zh_sugestion=''$otrPad'suggestion="步骤1 请检查阵列是否存在远端设备链路降级告警。&#10;   1.1 如果存在=>请按照对应修复建议进行修复，操作完成后如果告警未清除=>[步骤2]。&#10;   1.2 如果不存在=>[步骤2]。&#10;步骤2 检查从端对应配置是否超规格。&#10;   2.1 如果是，请删除不需要使用的配置，操作完成后，等待10分钟，如果告警未清除=>[步骤3]。&#10;   2.2 如果否=>[步骤3]。&#10;步骤3 检查NFS共享别名间是否存在冲突或与文件系统名冲突。&#10;   3.1 如果是，修改共享别名或者文件系统名，操作完成后，等待10分钟，如果告警未清除=>[步骤4]。&#10;   3.2 如果否=>[步骤4]。&#10;步骤4 请收集相关事件信息，然后联系技术支持工程师进行处理。"'
new_65431207943_zh_sugestion=''$otrPad'suggestion="步骤1 请检查阵列是否存在远端设备链路降级告警。&#10;   1.1 如果存在=&gt;请按照对应修复建议进行修复，操作完成后如果告警未清除=&gt;[步骤2]。&#10;   1.2 如果不存在=&gt;[步骤2]。&#10;步骤2 检查从端对应配置是否超规格。&#10;   2.1 如果是，请删除不需要使用的配置，操作完成后，等待10分钟，如果告警未清除=&gt;[步骤3]。&#10;   2.2 如果否=&gt;[步骤3]。&#10;步骤3 检查NFS共享别名间是否存在冲突或与文件系统名冲突。&#10;   3.1 如果是，删除从端共享别名冲突的共享或者修改从端冲突的文件系统名，操作完成后，等待10分钟，如果告警未清除=&gt;[步骤4]。&#10;   3.2 如果否=&gt;[步骤4]。&#10;步骤4 检查CIFS主端和从端共享名称是否冲突。&#10;   4.1 如果是，删除从端冲突的共享，操作完成后，等待10分钟，如果告警未清除=&gt;[步骤5]。&#10;   4.2 如果否=&gt;[步骤5]。&#10;步骤5 请收集相关事件信息，然后联系技术支持工程师进行处理。"'

origin_65431207943_en_sugestion=''$otrPad'suggestion="Step1 Check whether an alarm is generated indicating that the remote device link is degraded.&#10;   1.1 If yes, handle the alarm by taking recommended actions. If the alarm persists=>[Step2].&#10;   1.2 If no=>[Step2].&#10;Step2 Check whether configurations at the remote site exceed the threshold.&#10;   2.1 If yes, delete useless configurations. After the operation, wait 10 minutes. If the alarm persists=>[Step3].&#10;   2.2 If no=>[Step3].&#10;Step3 Check whether aliases of the NFS shares conflict with each other or the alias conflicts with the file system name.&#10;   3.1 If yes, change the share alias or the file system name. After the operation, wait 10 minutes. If the alarm persists=>[Step4].&#10;   3.2 If no=>[Step4].&#10;Step4 Collect related information and contact technical support engineers."'

new_65431207943_en_sugestion=''$otrPad'suggestion="Step1 Check whether an alarm is generated indicating that the remote device link is degraded.&#10;    1.1 If yes, handle the alarm by taking recommended actions. If the alarm persists=&gt;[Step2].&#10;    1.2 If no=&gt;[Step2].&#10;Step2 Check whether configurations at the remote site exceed the threshold.&#10;    2.1 If yes, delete useless configurations. After the operation, wait 10 minutes. If the alarm persists=&gt;[Step3].&#10;    2.2 If no=&gt;[Step3].&#10;Step3 Check whether aliases of the NFS shares conflict with each other or the alias conflicts with the file system name.&#10;    3.1 If yes, at the secondary end, delete the share whose alias causes the conflict or change the file system name that causes the conflict. Wait for 10 minutes. If the alarm persists=&gt;[Step4].&#10;    3.2 If no=&gt;[Step4].&#10;Step4 Check whether the CIFS share names at the primary and secondary ends conflict.&#10;    4.1 If yes, delete the share that causes the conflict from the secondary end. Wait for 10 minutes. If the alarm persists=&gt;[Step5].&#10;    4.2 If no=&gt;[Step5].&#10;Step5 Collect related information and contact technical support engineers."'


origin_64427065619_zh_sugestion=''$otrPad'suggestion="步骤1 请检查远程复制主端和从端文件系统所在存储池是否存在状态异常或空间满的告警。&#10;   1.1 如果存在=>请按照对应修复建议进行修复，操作完成后如果告警未清除=>[步骤2]。&#10;   1.2 如果不存在=>[步骤2]。&#10;步骤2 请检查远程复制主端和从端文件系统是否存在状态异常或空间满的告警。&#10;   2.1 如果存在=>请按照对应修复建议进行修复，操作完成后如果告警未清除=>[步骤3]。&#10;   2.2 如果不存在=>[步骤3]。&#10;步骤3 请检查远程复制主端和从端是否存在快照达到规格上限的告警。&#10;   3.1 如果存在=>请删除部分快照，操作完成后如果告警未清除=>[步骤4]。&#10;   3.2 如果不存在=>[步骤4]。&#10;步骤4 请检查阵列是否存在远端设备链路降级告警。&#10;   4.1 如果存在=>请按照对应修复建议进行修复，操作完成后如果告警未清除=>[步骤5]。&#10;   4.2 如果不存在=>[步骤5]。&#10;步骤5 请收集相关事件信息，然后联系技术支持工程师进行处理。"'

new_64427065619_zh_sugestion=''$otrPad'suggestion="步骤1 请检查远程复制主端和从端文件系统所在存储池是否存在状态异常或空间满的告警。&#10;   1.1 如果存在=&gt;请按照对应修复建议进行修复，操作完成后如果告警未清除=&gt;[步骤2]。&#10;   1.2 如果不存在=&gt;[步骤2]。&#10;步骤2 请检查远程复制主端和从端文件系统是否存在状态异常或空间满的告警。&#10;   2.1 如果存在=&gt;请按照对应修复建议进行修复，操作完成后如果告警未清除=&gt;[步骤3]。&#10;   2.2 如果不存在=&gt;[步骤3]。&#10;步骤3 请检查远程复制主端和从端是否存在快照达到规格上限的告警。&#10;   3.1 如果存在=&gt;请删除部分快照，操作完成后如果告警未清除=&gt;[步骤4]。&#10;   3.2 如果不存在=&gt;[步骤4]。&#10;步骤4 请检查阵列是否存在远端设备链路降级告警。&#10;   4.1 如果存在=&gt;请按照对应修复建议进行修复，操作完成后如果告警未清除=&gt;[步骤5]。&#10;   4.2 如果不存在=&gt;[步骤5]。&#10;步骤5 检查NFS共享别名间是否存在冲突或与文件系统名冲突。&#10;   5.1 如果是，删除从端共享别名冲突的共享或者修改从端冲突的文件系统名，操作完成后，等待10分钟，如果告警未清除=&gt;[步骤6]。&#10;   5.2 如果否=&gt;[步骤6]。&#10;步骤6 检查主端和从端CIFS共享名称是否存在冲突。&#10;   6.1 如果是，删除从端冲突的共享，操作完成后，等待10分钟，如果告警未清除=&gt;[步骤7]。&#10;   6.2 如果否=&gt;[步骤7]。&#10;步骤7 请收集相关事件信息，然后联系技术支持工程师进行处理。"'

origin_64427065619_en_sugestion=''$otrPad'suggestion="Step1 Check whether an alarm is generated indicating that the storage pool where the primary or secondary file system of the remote replication pair resides is faulty or full. &#10;   1.1 If yes, handle the alarm by taking recommended actions. If the alarm persists=>[Step2]. &#10;   1.2 If no=>[Step2]. &#10;Step2 Check whether an alarm is generated indicating that the primary or secondary file system of the remote replication pair is faulty or full.&#10;    2.1 If yes, handle the alarm by taking recommended actions. If the alarm persists=>[Step3].&#10;    2.2 If no=>[Step3].&#10;Step3 Check whether an alarm is generated indicating that the number of snapshots on the primary or secondary end of the remote replication pair reaches the upper limit.&#10;   3.1 If yes, delete some snapshots. If the alarm persists=>[Step4].&#10;   3.2 If no=>[Step4].&#10;Step4 Check whether an alarm is generated indicating that the remote device link is degraded.&#10;   4.1 If yes, handle the alarm by taking recommended actions. If the alarm persists=>[Step5].&#10;   4.2 If no=>[Step5].&#10;Step5 Collect related information and contact technical support engineers."'

new_64427065619_en_sugestion=''$otrPad'suggestion="Step1 Check whether an alarm is generated indicating that the storage pool where the primary or secondary file system of the remote replication pair resides is faulty or full.&#10;    1.1 If yes, handle the alarm by taking recommended actions. If the alarm persists=&gt;[Step2].&#10;    1.2 If no=&gt;[Step2].&#10;Step2 Check whether an alarm is generated indicating that the primary or secondary file system of the remote replication pair is faulty or full.&#10;    2.1 If yes, handle the alarm by taking recommended actions. If the alarm persists=&gt;[Step3].&#10;    2.2 If no=&gt;[Step3].&#10;Step3 Check whether an alarm is generated indicating that the number of snapshots on the primary or secondary end of the remote replication pair reaches the upper limit.&#10;    3.1 If yes, delete some snapshots. If the alarm persists=&gt;[Step4].&#10;    3.2 If no=&gt;[Step4].&#10;Step4 Check whether an alarm is generated indicating that the remote device link is degraded.&#10;    4.1 If yes, handle the alarm by taking recommended actions. If the alarm persists=&gt;[Step5].&#10;    4.2 If no=&gt;[Step5].&#10;Step5 Check where NFS share aliases conflict or conflict with file system names.&#10;    5.1 If yes, at the secondary end, delete the share whose alias causes the conflict or change the file system name that causes the conflict. Wait for 10 minutes. If the alarm persists=&gt;[Step6].&#10;    5.2 If no=&gt;[Step6].&#10;Step6 Check whether the CIFS share names at the primary and secondary ends conflict.&#10;    6.1 If yes, delete the share that causes the conflict from the secondary end. Wait for 10 minutes. If the alarm persists=&gt;[Step7].&#10;    6.2 If no=&gt;[Step7].&#10;Step7 Collect related information and contact technical support engineers."'

modify_cn_to_new_65431207943_sql="update alarmdefine_cn set AlmSuggest='$new_65431207943_zh_sugestion' WHERE AlmID=65431207943"
modify_cn_to_origin_65431207943_sql="update alarmdefine_cn set AlmSuggest='$origin_65431207943_zh_sugestion' WHERE AlmID=65431207943"
modify_en_to_new_65431207943_sql="update alarmdefine_en set AlmSuggest='$new_65431207943_en_sugestion' WHERE AlmID=65431207943"
modify_en_to_origin_65431207943_sql="update alarmdefine_en set AlmSuggest='$origin_65431207943_en_sugestion' WHERE AlmID=65431207943"

modify_cn_to_new_64427065619_sql="update alarmdefine_cn set AlmSuggest='$new_64427065619_zh_sugestion' WHERE AlmID=64427065619"
modify_cn_to_origin_64427065619_sql="update alarmdefine_cn set AlmSuggest='$origin_64427065619_zh_sugestion' WHERE AlmID=64427065619"
modify_en_to_new_64427065619_sql="update alarmdefine_en set AlmSuggest='$new_64427065619_en_sugestion' WHERE AlmID=64427065619"
modify_en_to_origin_64427065619_sql="update alarmdefine_en set AlmSuggest='$origin_64427065619_en_sugestion' WHERE AlmID=64427065619"

function startProcess()
{
    #执行重启DM进程
    OS_echo "Begin to restart ibase process."
    /OSM/script/reload_alarmconfig.sh ibase
    
    #执行重启ALARM进程
    OS_echo "Begin to restart alarm process."
    /OSM/script/reload_alarmconfig.sh alarm
    
    #重启snmp命令
    OS_echo "Begin to restart snmp process."
    /OSM/script/reload_alarmconfig.sh snmp

    return 0
}

function PATCH_START()
{  
    linenum=`sed -n -e "/65431207943/=" /OSM/conf/event_xve_zh.xml`
    if [ ! -n "$linenum" ]; then
    OS_echo "didn't find Alarm id 65431207943 in file event_xve_zh.xml."
    else
    let linenumber=$linenum+4
    linenumber=$linenumber'c'
    sed -i --follow-symlinks "$linenumber $new_65431207943_zh_sugestion" /OSM/conf/event_xve_zh.xml
    OS_echo "Modified alarm id 65431207943 into file event_xve_zh.xml."
    if [ ! -L /OSM/coffer_data/omm/event_xve_zh.xml ]; then
        cp -af /OSM/conf/event_xve_zh.xml /OSM/coffer_data/omm/event_xve_zh.xml
        OS_echo "copy event_xve_zh.xml to /OSM/coffer_data/omm/."
    fi
    fi
    #修改65431207943 数据库
    tmpResult=$(sqlite3 /OSM/conf/alarm_config.dat "select * from alarmdefine_cn where AlmID='65431207943';")
    if [ -n "$tmpResult" ]; then
    sqlite3 /OSM/conf/alarm_config.dat ".timeout 10000" "${modify_cn_to_new_65431207943_sql}"
    modifyResult=$?
    OS_echo "Alarm id 65431207943 modify in table alarmdefine_cn with result $modifyResult."
    RETRY_TIMES=0
        while [ $modifyResult -ne 0 ];do
            sqlite3 /OSM/conf/alarm_config.dat "${modify_cn_to_new_65431207943_sql}"
            modifyResult=$?
            OS_echo "Alarm id 65431207943 modify in table alarmdefine_cn with result $modifyResult."
            let RETRY_TIMES=$RETRY_TIMES+1
            if [ $RETRY_TIMES -gt 50 ];then
                break
            fi
            sleep 0.1
        done
    else
    OS_echo "Alarm id 65431207943 isn't in table alarmdefine_cn."
    fi

    linenum=`sed -n -e "/64427065619/=" /OSM/conf/event_xve_zh.xml`
    if [ ! -n "$linenum" ]; then
        OS_echo "didn't find Alarm id 64427065619 in file event_xve_zh.xml."
    else
        let linenumber=$linenum+4
        linenumber=$linenumber'c'
        sed -i --follow-symlinks "$linenumber $new_64427065619_zh_sugestion" /OSM/conf/event_xve_zh.xml
        OS_echo "Modified alarm id 64427065619 into file event_xve_zh.xml."
        if [ ! -L /OSM/coffer_data/omm/event_xve_zh.xml ]; then
            cp -af /OSM/conf/event_xve_zh.xml /OSM/coffer_data/omm/event_xve_zh.xml
            OS_echo "copy event_xve_zh.xml to /OSM/coffer_data/omm/."
        fi
    fi
    #修改64427065619 数据库
    tmpResult=$(sqlite3 /OSM/conf/alarm_config.dat "select * from alarmdefine_cn where AlmID='64427065619';")
    if [ -n "$tmpResult" ]; then
    sqlite3 /OSM/conf/alarm_config.dat ".timeout 10000" "${modify_cn_to_new_64427065619_sql}"
    modifyResult=$?
    OS_echo "Alarm id 64427065619 modify in table alarmdefine_cn with result $modifyResult."
    RETRY_TIMES=0
        while [ $modifyResult -ne 0 ];do
            sqlite3 /OSM/conf/alarm_config.dat "${modify_cn_to_new_64427065619_sql}"
            modifyResult=$?
            OS_echo "Alarm id 64427065619 modify in table alarmdefine_cn with result $modifyResult."
            let RETRY_TIMES=$RETRY_TIMES+1
            if [ $RETRY_TIMES -gt 50 ];then
                break
            fi
            sleep 0.1
        done
    else
    OS_echo "Alarm id 64427065619 isn't in table alarmdefine_cn."
    fi

    linenum=`sed -n -e "/65431207943/=" /OSM/conf/event_xve_en.xml`
    if [ ! -n "$linenum" ]; then
         OS_echo "didn't find Alarm id 65431207943 in file event_xve_en.xml."
    else
    let linenumber=$linenum+4
    linenumber=$linenumber'c'
    sed -i --follow-symlinks "$linenumber $new_65431207943_en_sugestion" /OSM/conf/event_xve_en.xml
    OS_echo "Modified alarm id 65431207943 into file event_xve_en.xml."
    if [ ! -L /OSM/coffer_data/omm/event_xve_en.xml ]; then
        cp -af /OSM/conf/event_xve_en.xml /OSM/coffer_data/omm/event_xve_en.xml
        OS_echo "copy event_xve_zh.xml to /OSM/coffer_data/omm/."
    fi
    fi
    #修改65431207943 数据库
    tmpResult=$(sqlite3 /OSM/conf/alarm_config.dat "select * from alarmdefine_en where AlmID='65431207943';")
    if [ -n "$tmpResult" ]; then
    sqlite3 /OSM/conf/alarm_config.dat ".timeout 10000" "${modify_en_to_new_65431207943_sql}"
    modifyResult=$?
    OS_echo "Alarm id 65431207943 modify in table alarmdefine_en with result $modifyResult."
    RETRY_TIMES=0
        while [ $modifyResult -ne 0 ];do
            sqlite3 /OSM/conf/alarm_config.dat "${modify_en_to_new_65431207943_sql}"
            modifyResult=$?
            OS_echo "Alarm id 65431207943 modify in table alarmdefine_en with result $modifyResult."
            let RETRY_TIMES=$RETRY_TIMES+1
            if [ $RETRY_TIMES -gt 50 ];then
                break
            fi
            sleep 0.1
        done
    else
    OS_echo "Alarm id 65431207943 isn't in table alarmdefine_en ."
    fi

    linenum=`sed -n -e "/64427065619/=" /OSM/conf/event_xve_en.xml`
    if [ ! -n "$linenum" ]; then
    OS_echo "didn't find Alarm id 64427065619 in file event_xve_en.xml."
    else
    let linenumber=$linenum+4
    linenumber=$linenumber'c'
    sed -i --follow-symlinks "$linenumber $new_64427065619_en_sugestion" /OSM/conf/event_xve_en.xml
    OS_echo "Modified alarm id 64427065619 into file event_xve_en.xml."
    if [ ! -L /OSM/coffer_data/omm/event_xve_en.xml ]; then
        cp -af /OSM/conf/event_xve_en.xml /OSM/coffer_data/omm/event_xve_en.xml
        OS_echo "copy event_xve_zh.xml to /OSM/coffer_data/omm/."
    fi
    fi

    #修改64427065619 数据库
    tmpResult=$(sqlite3 /OSM/conf/alarm_config.dat "select * from alarmdefine_en where AlmID='64427065619';")
    if [ -n "$tmpResult" ]; then
    sqlite3 /OSM/conf/alarm_config.dat ".timeout 10000" "${modify_en_to_new_64427065619_sql}"
    modifyResult=$?
    OS_echo "Alarm id 64427065619 modify in table alarmdefine_en with result $modifyResult."
    RETRY_TIMES=0
        while [ $modifyResult -ne 0 ];do
            sqlite3 /OSM/conf/alarm_config.dat "${modify_en_to_new_64427065619_sql}"
            modifyResult=$?
            OS_echo "Alarm id 64427065619 modify in table alarmdefine_en with result $modifyResult."
            let RETRY_TIMES=$RETRY_TIMES+1
            if [ $RETRY_TIMES -gt 50 ];then
                break
            fi
            sleep 0.1
        done
    else
    OS_echo "Alarm id 64427065619 isn't in table alarmdefine_en ."
    fi

    linenum=`sed -n -e "/65431207943/=" /ISM/agent/snmp/conf/snmpagent/alarm_config.xml`
    if [ ! -n "$linenum" ]; then
         OS_echo "didn't find Alarm id 65431207943 in file /ISM/agent/snmp/conf/snmpagent/alarm_config.xml."
    else
    let linenumber=$linenum+4
    linenumber=$linenumber'c'
    sed -i "$linenumber $new_65431207943_en_sugestion" /ISM/agent/snmp/conf/snmpagent/alarm_config.xml
    OS_echo "Modified alarm id 65431207943 into file /ISM/agent/snmp/conf/snmpagent/alarm_config.xml."
    fi

    linenum=`sed -n -e "/64427065619/=" /ISM/agent/snmp/conf/snmpagent/alarm_config.xml`
    if [ ! -n "$linenum" ]; then
    OS_echo "didn't find Alarm id 64427065619 in file /ISM/agent/snmp/conf/snmpagent/alarm_config.xml."
    else
    let linenumber=$linenum+4
    linenumber=$linenumber'c'
    sed -i "$linenumber $new_64427065619_en_sugestion" /ISM/agent/snmp/conf/snmpagent/alarm_config.xml
    OS_echo "Modified alarm id 64427065619 into file /ISM/agent/snmp/conf/snmpagent/alarm_config.xml."
    fi


    startProcess
    return
}

function PATCH_END()
{
    return
}

function PATCH_ROLLSTART()
{
    linenum=`sed -n -e "/65431207943/=" /OSM/conf/event_xve_zh.xml`
    if [ ! -n "$linenum" ]; then
    OS_echo "didn't find Alarm id 65431207943 in file event_xve_zh.xml."
    else

    let linenumber=$linenum+4
    linenumber=$linenumber'c'
    sed -i --follow-symlinks "$linenumber $origin_65431207943_zh_sugestion" /OSM/conf/event_xve_zh.xml
    OS_echo "Modified alarm id 65431207943 into file event_xve_zh.xml."
    if [ ! -L /OSM/coffer_data/omm/event_xve_zh.xml ]; then
        cp -af /OSM/conf/event_xve_zh.xml /OSM/coffer_data/omm/event_xve_zh.xml
        OS_echo "copy event_xve_zh.xml to /OSM/coffer_data/omm/export_import"
    fi
    fi
    #修改65431207943 数据库
    tmpResult=$(sqlite3 /OSM/conf/alarm_config.dat "select * from alarmdefine_cn where AlmID='65431207943';")
    if [ -n "$tmpResult" ]; then
    sqlite3 /OSM/conf/alarm_config.dat ".timeout 10000" "${modify_cn_to_origin_65431207943_sql}"
    modifyResult=$?
    OS_echo "Alarm id 65431207943 modify in table alarmdefine_cn with result $modifyResult."
    RETRY_TIMES=0
        while [ $modifyResult -ne 0 ];do
            sqlite3 /OSM/conf/alarm_config.dat "${modify_cn_to_origin_65431207943_sql}"
            modifyResult=$?
            OS_echo "Alarm id 65431207943 modify in table alarmdefine_cn with result $modifyResult."
            let RETRY_TIMES=$RETRY_TIMES+1
            if [ $RETRY_TIMES -gt 50 ];then
                break
            fi
            sleep 0.1
        done
    else
    OS_echo "Alarm id 65431207943 isn't in table alarmdefine_cn."
    fi

    linenum=`sed -n -e "/64427065619/=" /OSM/conf/event_xve_zh.xml`
    if [ ! -n "$linenum" ]; then
        OS_echo "didn't find Alarm id 64427065619 in file event_xve_zh.xml."
    else
        let linenumber=$linenum+4
        linenumber=$linenumber'c'
        sed -i --follow-symlinks "$linenumber $origin_64427065619_zh_sugestion" /OSM/conf/event_xve_zh.xml
        OS_echo "Modified alarm id 64427065619 into file event_xve_zh.xml."
        if [ ! -L /OSM/coffer_data/omm/event_xve_zh.xml ]; then
            cp -af /OSM/conf/event_xve_zh.xml /OSM/coffer_data/omm/event_xve_zh.xml
            OS_echo "copy event_xve_zh.xml to /OSM/coffer_data/omm/export_import"
        fi
    fi
    #修改64427065619 数据库
    tmpResult=$(sqlite3 /OSM/conf/alarm_config.dat "select * from alarmdefine_cn where AlmID='64427065619';")
    if [ -n "$tmpResult" ]; then
    sqlite3 /OSM/conf/alarm_config.dat ".timeout 10000" "${modify_cn_to_origin_64427065619_sql}"
    modifyResult=$?
    OS_echo "Alarm id 64427065619 modify in table alarmdefine_cn with result $modifyResult."
    RETRY_TIMES=0
        while [ $modifyResult -ne 0 ];do
            sqlite3 /OSM/conf/alarm_config.dat  "${modify_cn_to_origin_64427065619_sql}"
            modifyResult=$?
            OS_echo "Alarm id 64427065619 modify in table alarmdefine_cn with result $modifyResult."
            let RETRY_TIMES=$RETRY_TIMES+1
            if [ $RETRY_TIMES -gt 50 ];then
                break
            fi
            sleep 0.1
        done
    else
    OS_echo "Alarm id 64427065619 isn't in table alarmdefine_cn."
    fi

    linenum=`sed -n -e "/65431207943/=" /OSM/conf/event_xve_en.xml`
    if [ ! -n "$linenum" ]; then
         OS_echo "didn't find Alarm id 65431207943 in file event_xve_en.xml."
    else
    let linenumber=$linenum+4
    linenumber=$linenumber'c'
    sed -i --follow-symlinks "$linenumber $origin_65431207943_en_sugestion" /OSM/conf/event_xve_en.xml
    OS_echo "Modified alarm id 65431207943 into file event_xve_en.xml."
    if [ ! -L /OSM/coffer_data/omm/event_xve_en.xml ]; then
        cp -af /OSM/conf/event_xve_en.xml /OSM/coffer_data/omm/event_xve_en.xml
        OS_echo "copy event_xve_en.xml to /OSM/coffer_data/omm/export_import"
    fi
    fi
    #修改65431207943 数据库
    tmpResult=$(sqlite3 /OSM/conf/alarm_config.dat "select * from alarmdefine_en where AlmID='65431207943';")
    if [ -n "$tmpResult" ]; then
    sqlite3 /OSM/conf/alarm_config.dat ".timeout 10000" "${modify_en_to_origin_65431207943_sql}"
    modifyResult=$?
    OS_echo "Alarm id 65431207943 modify in table alarmdefine_en with result $modifyResult."
    RETRY_TIMES=0
        while [ $modifyResult -ne 0 ];do
            sqlite3 /OSM/conf/alarm_config.dat "${modify_en_to_origin_65431207943_sql}"
            modifyResult=$?
            OS_echo "Alarm id 65431207943 modify in table alarmdefine_en with result $modifyResult."
            let RETRY_TIMES=$RETRY_TIMES+1
            if [ $RETRY_TIMES -gt 50 ];then
                break
            fi
            sleep 0.1
        done
    else
    OS_echo "Alarm id 65431207943 isn't in table alarmdefine_en ."
    fi

    linenum=`sed -n -e "/64427065619/=" /OSM/conf/event_xve_en.xml`
    if [ ! -n "$linenum" ]; then
    OS_echo "didn't find Alarm id 64427065619 in file event_xve_en.xml."
    else
    let linenumber=$linenum+4
    linenumber=$linenumber'c'
    sed -i --follow-symlinks "$linenumber $origin_64427065619_en_sugestion" /OSM/conf/event_xve_en.xml
    OS_echo "Modified alarm id 64427065619 into file event_xve_en.xml."
    if [ ! -L /OSM/coffer_data/omm/event_xve_en.xml ]; then
        cp -af /OSM/conf/event_xve_en.xml /OSM/coffer_data/omm/event_xve_en.xml
        OS_echo "copy event_xve_en.xml to /OSM/coffer_data/omm/export_import"
    fi
    fi
    #修改64427065619 数据库
    tmpResult=$(sqlite3 /OSM/conf/alarm_config.dat "select * from alarmdefine_en where AlmID='64427065619';")
    if [ -n "$tmpResult" ]; then
    sqlite3 /OSM/conf/alarm_config.dat ".timeout 10000" "${modify_en_to_origin_64427065619_sql}"
    modifyResult=$?
    OS_echo "Alarm id 64427065619 modify in table alarmdefine_en with result $modifyResult."
    RETRY_TIMES=0
        while [ $modifyResult -ne 0 ];do
            sqlite3 /OSM/conf/alarm_config.dat "${modify_en_to_origin_64427065619_sql}"
            modifyResult=$?
            OS_echo "Alarm id 64427065619 modify in table alarmdefine_en with result $modifyResult."
            let RETRY_TIMES=$RETRY_TIMES+1
            if [ $RETRY_TIMES -gt 50 ];then
                break
            fi
            sleep 0.1
        done
    else
    OS_echo "Alarm id 64427065619 isn't in table alarmdefine_en ."
    fi

    linenum=`sed -n -e "/65431207943/=" /ISM/agent/snmp/conf/snmpagent/alarm_config.xml`
    if [ ! -n "$linenum" ]; then
         OS_echo "didn't find Alarm id 65431207943 in file /ISM/agent/snmp/conf/snmpagent/alarm_config.xml."
    else
    let linenumber=$linenum+4
    linenumber=$linenumber'c'
    sed -i "$linenumber $origin_65431207943_en_sugestion" /ISM/agent/snmp/conf/snmpagent/alarm_config.xml
    OS_echo "Modified alarm id 65431207943 into file /ISM/agent/snmp/conf/snmpagent/alarm_config.xml."
    fi

    linenum=`sed -n -e "/64427065619/=" /ISM/agent/snmp/conf/snmpagent/alarm_config.xml`
    if [ ! -n "$linenum" ]; then
    OS_echo "didn't find Alarm id 64427065619 in file /ISM/agent/snmp/conf/snmpagent/alarm_config.xml."
    else
    let linenumber=$linenum+4
    linenumber=$linenumber'c'
    sed -i "$linenumber $origin_64427065619_en_sugestion" /ISM/agent/snmp/conf/snmpagent/alarm_config.xml
    OS_echo "Modified alarm id 64427065619 into file /ISM/agent/snmp/conf/snmpagent/alarm_config.xml."
    fi
    
    startProcess
    return
}

function PATCH_ROLLEND()
{
    return
}
#start：打补丁前需要执行的操作，脚本的执行时间点在替换文件前
#end：打补丁后需要执行的操作，脚本的执行时间点在替换文件后
#rollstart：回滚补丁时需要执行的操作，脚本的执行时间点在文件被恢复之前。
#rollend：回滚补丁时需要执行的操作，脚本的执行时间点在文件被恢复之后。
#PATCH_CLOSE_SWITCH:先读取性能统计开关的状态，将其值保存到switch中,并关闭性能统计开关
#PATCH_OPEN_SWITCH:如果用户之前是打开状态，将其开关打开
#log "command is "$1

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

