From f55ad1cb7de26c4ea9292310a42b500866396f46 Mon Sep 17 00:00:00 2001 From: qiaofeng1227 <76487013@qq.com> Date: Fri, 13 Oct 2023 18:08:18 +0800 Subject: [PATCH] systemd --- systemd/script/crontab.sh | 10 ++++++---- version.json | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/systemd/script/crontab.sh b/systemd/script/crontab.sh index 955a2f63..3674863e 100644 --- a/systemd/script/crontab.sh +++ b/systemd/script/crontab.sh @@ -12,16 +12,17 @@ on_change() { cockpit_port=$(sudo docker exec -i websoft9-apphub apphub getconfig --section cockpit --key port) sudo sed -i "s/ListenStream=[0-9]*/ListenStream=${cockpit_port}/" /lib/systemd/system/cockpit.socket sudo systemctl daemon-reload - sudo systemctl restart cockpit + sudo systemctl restart cockpit.socket 2> /dev/null + sudo systemctl restart cockpit || exit 1 set_Firewalld set -e } set_Firewalld(){ echo "Set cockpit service to Firewalld..." - sudo sed -i "s/port=\"[0-9]*\"/port=\"$cockpit_port\"/g" /etc/firewalld/services/cockpit.xml - sudo sed -i "s/port=\"[0-9]*\"/port=\"$cockpit_port\"/g" /usr/lib/firewalld/services/cockpit.xml - sudo firewall-cmd --reload + sudo sed -i "s/port=\"[0-9]*\"/port=\"$cockpit_port\"/g" /etc/firewalld/services/cockpit.xml 2>/dev/nul + sudo sed -i "s/port=\"[0-9]*\"/port=\"$cockpit_port\"/g" /usr/lib/firewalld/services/cockpit.xml 2>/dev/nul + sudo firewall-cmd --reload 2>/dev/nul } # 循环,持续监控 @@ -29,6 +30,7 @@ while true; do # monitor /lib/systemd/system/cockpit.socket and config.ini, make sure config.ini port is the same with cockpit.socket inotifywait -e modify -m $FILES | while read PATH EVENT FILE; do echo "Set cockpit port by config.ini..." + export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:$PATH on_change done done diff --git a/version.json b/version.json index cb2a679d..76cf1883 100644 --- a/version.json +++ b/version.json @@ -1,5 +1,5 @@ { - "version": "0.8.26-rc35", + "version": "0.8.26-rc36", "plugins": { "portainer": "0.0.6", "nginx": "0.0.5",