查配置文件中配置项,不存在则添加
下面是查xxx服务的supervisor的stopwaitsecs配置,然后不存在则添加
function update_xxx_supervisor_stopwaitsecs() {
# 更新xxx的supervisor配置文件中的stopwaitsecs
echo "update xxx supervisor stopwaitsecs config"
xxx_supervisor_conf="/etc/supervisor/conf.d/xxx.conf"
if [ -f $xxx_supervisor_conf ];then
stopwaitsecs=$(cat $xxx_supervisor_conf | grep stopwaitsecs)
if [ -z "$stopwaitsecs" ];then
sed -i '/program:xxx/astopwaitsecs=50' $xxx_supervisor_conf
echo "update_xxx_supervisor_stopwaitsecs $xxx_supervisor_conf success."
supervisorctl update
else
echo "stopwaitsecs already exists in in $xxx_supervisor_conf."
fi
else
echo "file $xxx_supervisor_conf not exist."
fi
}



