1
0

del: deb22打包移除kvdb服务绑定

This commit is contained in:
TsMask
2024-07-27 11:07:46 +08:00
parent 8a4bd1216a
commit 9ab3d2d53f
8 changed files with 14 additions and 4263 deletions

View File

@@ -1,10 +1,6 @@
# !/bin/bash # !/bin/bash
RedisRootDir=/usr/local
OMCRootDir=/usr/local/omc OMCRootDir=/usr/local/omc
RedisOldRootDir=/usr/local/db
RedisConfDir=${RedisRootDir}/etc/kvdb
DependsRootDir=${OMCRootDir}/depends
SystemdRootDir=/lib/systemd/system SystemdRootDir=/lib/systemd/system
OMCEtcDir=${OMCRootDir}/etc OMCEtcDir=${OMCRootDir}/etc
FERootDir=${OMCRootDir}/htdocs/front FERootDir=${OMCRootDir}/htdocs/front
@@ -15,7 +11,6 @@ UsrLocalBinDir=/usr/local/bin
OmcDaemon=omcd OmcDaemon=omcd
NginxEtcDir=/etc/nginx NginxEtcDir=/etc/nginx
NginxConfDir=${NginxEtcDir}/conf.d NginxConfDir=${NginxEtcDir}/conf.d
NginxSiteAvailable=${NginxEtcDir}/sites-available
CFileList="restconf.yaml crontask.yaml tasks.yaml sshsvc.yaml capconf.yaml omc.conf" CFileList="restconf.yaml crontask.yaml tasks.yaml sshsvc.yaml capconf.yaml omc.conf"
LogoFileList="zh_brand.png zh_icon.png en_brand.png en_icon.png" LogoFileList="zh_brand.png zh_icon.png en_brand.png en_icon.png"
@@ -25,7 +20,6 @@ echo " sudo systemctl start/stop/restart/status restagent.service"
echo " sudo systemctl start/stop/restart/status crontask.service" echo " sudo systemctl start/stop/restart/status crontask.service"
echo " sudo systemctl start/stop/restart/status sshsvc.service" echo " sudo systemctl start/stop/restart/status sshsvc.service"
echo " sudo systemctl start/stop/restart/status captrace.service" echo " sudo systemctl start/stop/restart/status captrace.service"
echo " sudo systemctl start/stop/restart/status kvdb.service"
echo " or run: " echo " or run: "
echo " sudo /usr/local/omc/bin/omcsvc.sh start/stop/restart/status" echo " sudo /usr/local/omc/bin/omcsvc.sh start/stop/restart/status"
echo "" echo ""
@@ -57,85 +51,27 @@ for CFile in ${CFileList}; do
fi fi
done done
# Install redis db if not exist /usr/local/db
if [ ! -e "${RedisRootDir}/bin/kvdb-server" ]; then
# if [ ! -e "${RedisRootDir}" ]; then
# mkdir -p ${RedisRootDir}
# fi
# stop old adb service
if [ -e "${RedisOldRootDir}/bin/redis-server" ] && [ -e "${SystemdRootDir}/adb.service" ]; then
systemctl stop adb.service
systemctl disable adb.service
fi
# stop adb service
if [ -e "${UsrLocalBinDir}/adb-server" ] && [ -e "${SystemdRootDir}/adb.service" ]; then
systemctl stop adb.service
systemctl disable adb.service
fi
cp -rf ${DependsRootDir}/kvdb/* /
chmod +rx ${RedisRootDir}/bin/kvdb*
if [ ! -e "${RedisConfDir}/kvdb.conf" ]; then
cp ${RedisConfDir}/default/kvdb.conf ${RedisConfDir}
fi
sed -i 's/replica-read-only yes/replica-read-only no/g' ${RedisConfDir}/kvdb.conf
LINE="masterauth helloearth"
FILE="${RedisConfDir}/kvdb.conf"
# 检查文件中是否存在该行
if ! grep -qxF "$LINE" "$FILE"; then
# 如果不存在,将其添加到文件末尾
echo "$LINE" >> "$FILE"
fi
# copy the old adb dump.rdb
if [ -e "${RedisOldRootDir}/bin/conf/dump.rdb" ] && [ ! -e "${RedisRootDir}/etc/kvdb/dump.rdb" ]; then
cp -f ${RedisOldRootDir}/bin/conf/dump.rdb ${RedisRootDir}/etc/kvdb/;
mv -f ${RedisRootDir}/db ${RedisRootDir}/adb.old
fi
# copy the adb dump.rdb
if [ -e "${RedisRootDir}/etc/adb/dump.rdb" ] && [ ! -e "${RedisRootDir}/etc/kvdb/dump.rdb" ]; then
cp -f ${RedisRootDir}/etc/adb/dump.rdb ${RedisRootDir}/etc/kvdb/;
mv -f ${RedisRootDir}/etc/adb ${RedisRootDir}/etc/adb.old
fi
# cp -f ${DependsRootDir}/systemd/kvdb.service ${SystemdRootDir}
else
if [ ! -e "${RedisConfDir}/kvdb.conf" ]; then
cp ${RedisConfDir}/default/kvdb.conf ${RedisConfDir}
fi
sed -i 's/replica-read-only yes/replica-read-only no/g' ${RedisConfDir}/kvdb.conf
LINE="masterauth helloearth"
FILE="${RedisConfDir}/kvdb.conf"
# 检查文件中是否存在该行
if ! grep -qxF "$LINE" "$FILE"; then
# 如果不存在,将其添加到文件末尾
echo "$LINE" >> "$FILE"
fi
fi
if [ ! -e "${FERootDir}/config.js" ]; then if [ ! -e "${FERootDir}/config.js" ]; then
cp ${FERootDir}/default/config.js ${FERootDir}; cp ${FERootDir}/default/config.js ${FERootDir};
fi fi
for LogoFile in ${LogoFileList}; do for LogoFile in ${LogoFileList}; do
if [ ! -e "${OMCStaticDir}/logo/${LogoFile}" ]; then if [ ! -e "${OMCStaticDir}/logo/${LogoFile}" ]; then
cp ${OMCStaticDir}/agt.d/logo/${LogoFile} ${OMCStaticDir}/logo; cp ${OMCStaticDir}/agt.d/logo/${LogoFile} ${OMCStaticDir}/logo;
fi fi
done done
if ! id -u omc >/dev/null 2>&1 ; then if ! id -u omc >/dev/null 2>&1 ; then
useradd -d /opt/omc -m -s /bin/bash -pomc123 omc; useradd -d /opt/omc -m -s /bin/bash -pomc123 omc;
mkdir -p /opt/omc/ftp mkdir -p /opt/omc/ftp
else else
echo "user omc exist"; echo "user omc exist";
fi fi
if [ ! -e "${NginxConfDir}/omc.conf" ]; then if [ ! -e "${NginxConfDir}/omc.conf" ]; then
mkdir -p ${NginxConfDir} mkdir -p ${NginxConfDir}
cp -f ${OMCEtcDir}/nginx/omc.conf ${NginxConfDir}; cp -f ${OMCEtcDir}/nginx/omc.conf ${NginxConfDir};
fi fi
#cp -f ${OMCEtcDir}/nginx/default ${NginxSiteAvailable}
if [ -e "${NginxSiteAvailable}/default" ]; then
sed -i 's/listen 80 default_server;/listen 1080 default_server;/g' ${NginxSiteAvailable}/default
sed -i 's/listen \[::\]:80 default_server;/listen \[::\]:1080 default_server;/g' ${NginxSiteAvailable}/default
fi
# disable auto upgrade # disable auto upgrade
systemctl disable --now unattended-upgrades systemctl disable --now unattended-upgrades
@@ -144,16 +80,14 @@ systemctl enable restagent.service
systemctl enable crontask.service systemctl enable crontask.service
systemctl enable sshsvc.service systemctl enable sshsvc.service
systemctl enable captrace.service systemctl enable captrace.service
systemctl enable kvdb.service
systemctl daemon-reload systemctl daemon-reload
systemctl stop nginx.service
systemctl stop restagent.service systemctl stop restagent.service
systemctl stop crontask.service systemctl stop crontask.service
systemctl stop sshsvc.service systemctl stop sshsvc.service
systemctl stop captrace.service systemctl stop captrace.service
systemctl stop kvdb.service
systemctl start nginx.service
systemctl start kvdb.service
systemctl start crontask.service systemctl start crontask.service
systemctl start sshsvc.service systemctl start sshsvc.service
systemctl start captrace.service systemctl start captrace.service

View File

@@ -8,20 +8,19 @@ rm libwiretap.so.12
rm libwiretap.so rm libwiretap.so
rm libwsutil.so.13 rm libwsutil.so.13
rm libwsutil.so rm libwsutil.so
systemctl stop nginx.service
systemctl stop restagent.service
systemctl stop crontask.service
systemctl stop sshsvc.service
systemctl stop captrace.service
#systemctl stop kvdb.service
#rm -rf /usr/local/omc #rm -rf /usr/local/omc
rm -rf /etc/nginx/conf.d/omc.conf rm -rf /etc/nginx/conf.d/omc.conf
rm -f /usr/local/bin/omcd rm -f /usr/local/bin/omcd
systemctl stop restagent.service
systemctl stop crontask.service
systemctl stop sshsvc.service
systemctl stop captrace.service
systemctl disable restagent.service systemctl disable restagent.service
systemctl disable crontask.service systemctl disable crontask.service
systemctl disable sshsvc.service systemctl disable sshsvc.service
systemctl disable captrace.service systemctl disable captrace.service
#systemctl disable kvdb.service
systemctl daemon-reload systemctl daemon-reload

View File

@@ -1,11 +0,0 @@
[Service]
Type=forking
ExecStart=/usr/local/bin/kvdb-server /usr/local/etc/kvdb/kvdb.conf
ExecStopPost=
PIDFile=
Restart=always
RestartSec=3
[Install]
WantedBy=multi-user.target