From eb7f33c4774d5c3376915e60ce006c3275a87412 Mon Sep 17 00:00:00 2001 From: simonzhangsz Date: Thu, 14 Sep 2023 14:46:03 +0800 Subject: [PATCH] conf --- debbuild/DEBIAN/postinst | 13 +++++++++++++ debbuild/usr/local/db/bin/conf/default/redis.conf | 2 ++ rpmbuild/BUILD/db/bin/conf/default/redis.conf | 4 +++- rpmbuild/SPECS/omc.spec | 1 + 4 files changed, 19 insertions(+), 1 deletion(-) diff --git a/debbuild/DEBIAN/postinst b/debbuild/DEBIAN/postinst index d5a1450..04c8d15 100644 --- a/debbuild/DEBIAN/postinst +++ b/debbuild/DEBIAN/postinst @@ -1,4 +1,9 @@ # !/bin/sh + +RedisConfDir=/usr/local/db/bin/conf +OMCEtcDir=/usr/local/omc/etc +CFileList="restconf.yaml crontask.yaml tasks.yaml sshsvc.yaml capconf.yaml" + echo "" echo "* To start/stop/restart/status omc service, please run:" echo " sudo systemctl start/stop/restart/status restagent.service" @@ -17,6 +22,14 @@ systemctl enable captrace.service systemctl enable adb.service chmod +rx /usr/local/db/bin/* systemctl daemon-reload +for CFile in $CFileList; do + if [ ! -e "${OMCEtcDir}/${CFile}" ]; then + cp ${OMCEtcDir}/default/${CFile} ${OMCEtcDir}; + fi +done +if [ ! -e "${RedisConfDir}/redis.conf" ]; then + cp ${RedisConfDir}/default/redis.conf ${RedisConfDir}; +fi if ! id -u omc >/dev/null 2>&1 ; then useradd -d /opt/omc -m -s /bin/bash -pomc123 omc; mkdir -p /opt/omc/ftp diff --git a/debbuild/usr/local/db/bin/conf/default/redis.conf b/debbuild/usr/local/db/bin/conf/default/redis.conf index 2679549..96c65aa 100644 --- a/debbuild/usr/local/db/bin/conf/default/redis.conf +++ b/debbuild/usr/local/db/bin/conf/default/redis.conf @@ -1369,4 +1369,6 @@ rdb-save-incremental-fsync yes # Maximum number of set/hash/zset/list fields that will be processed from # the main dictionary scan # active-defrag-max-scan-fields 1000 + +# set slave of UDM primary redis slaveof 192.168.4.228 6379 diff --git a/rpmbuild/BUILD/db/bin/conf/default/redis.conf b/rpmbuild/BUILD/db/bin/conf/default/redis.conf index 5931f85..6a927cc 100644 --- a/rpmbuild/BUILD/db/bin/conf/default/redis.conf +++ b/rpmbuild/BUILD/db/bin/conf/default/redis.conf @@ -84,7 +84,7 @@ # mode. # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ #bind 127.0.0.1 -::1 -bind 127.0.0.1 192.168.0.229 +bind 127.0.0.1 # Protected mode is a layer of security protection, in order to avoid that # Redis instances left open on the internet are accessed and exploited. @@ -2081,4 +2081,6 @@ replica-weighting-factor 2 # disk space or any other I/O error Redis will instead use memory. # # blob-support false + +# set slave of UDM primary redis slaveof 192.168.4.228 6379 diff --git a/rpmbuild/SPECS/omc.spec b/rpmbuild/SPECS/omc.spec index a7ae864..535b731 100644 --- a/rpmbuild/SPECS/omc.spec +++ b/rpmbuild/SPECS/omc.spec @@ -54,6 +54,7 @@ cp -f systemd/adb.service ${RPM_BUILD_ROOT}/lib/systemd/system/adb.service # 安装完成后执行 %post +if [ ! -e "${RedisConfDir}/redis.conf" ]; then cp ${RedisConfDir}/default/redis.conf ${RedisConfDir}; fi if ! id -u omc >/dev/null 2>&1 ; then useradd -d /opt/omc -m -s /bin/bash -p1000ftp@kp omc; else echo "user omc exist"; fi mkdir -p /opt/omc/ftp mkdir -p /opt/omc/ftp/log