# not install userjail
userjailPattern="CHECK_IPTABLES=/opt/OperationCenter/AppBase/HA/hascript/check_iptables.sh"
userjailReplace="#CHECK_IPTABLES=/opt/OperationCenter/AppBase/HA/hascript/check_iptables.sh"
userPattern="bash \${CHECK_IPTABLES} \${LOG_FILE}"
userReplace="#bash \${CHECK_IPTABLES} \${LOG_FILE}"
userjail_conf="/opt/OperationCenter/AppBase/HA/hascript/schedule_task_ha_monitor.sh"
#userjail_conf="schedule_task_ha_monitor.sh"
function userjail()
{
line_num=$(cat ${userjail_conf} | grep -n "${userjailReplace}" | awk -F ":" NR==1'{print $1}')
if [[ $line_num -gt 0 ]];then
return
fi
line_num=$(cat ${userjail_conf} | grep -n "${userjailPattern}" | awk -F ":" NR==1'{print $1}')
if [[ $line_num -gt 0 ]];then
sed -i "${line_num}d" ${userjail_conf}
sed -i "${line_num}i${userjailReplace}" ${userjail_conf}
fi
line_num=$(cat ${userjail_conf} | grep -n "${userPattern}" | awk -F ":" NR==1'{print $1}')
if [[ $line_num -gt 0 ]];then
sed -i "${line_num}d" ${userjail_conf}
sed -i "${line_num}i${userReplace}" ${userjail_conf}
fi
}
userjailPattern="CHECK_IPTABLES=/opt/OperationCenter/AppBase/HA/hascript/check_iptables.sh"
userjailReplace="#CHECK_IPTABLES=/opt/OperationCenter/AppBase/HA/hascript/check_iptables.sh"
userPattern="bash \${CHECK_IPTABLES} \${LOG_FILE}"
userReplace="#bash \${CHECK_IPTABLES} \${LOG_FILE}"
userjail_conf="/opt/OperationCenter/AppBase/HA/hascript/schedule_task_ha_monitor.sh"
#userjail_conf="schedule_task_ha_monitor.sh"
function userjail()
{
line_num=$(cat ${userjail_conf} | grep -n "${userjailReplace}" | awk -F ":" NR==1'{print $1}')
if [[ $line_num -gt 0 ]];then
return
fi
line_num=$(cat ${userjail_conf} | grep -n "${userjailPattern}" | awk -F ":" NR==1'{print $1}')
if [[ $line_num -gt 0 ]];then
sed -i "${line_num}d" ${userjail_conf}
sed -i "${line_num}i${userjailReplace}" ${userjail_conf}
fi
line_num=$(cat ${userjail_conf} | grep -n "${userPattern}" | awk -F ":" NR==1'{print $1}')
if [[ $line_num -gt 0 ]];then
sed -i "${line_num}d" ${userjail_conf}
sed -i "${line_num}i${userReplace}" ${userjail_conf}
fi
}