mirror of
https://github.com/Websoft9/websoft9.git
synced 2025-01-23 09:20:20 +08:00
rc2
This commit is contained in:
parent
da45cd1734
commit
d81300fa97
@ -5,20 +5,6 @@ cockpit_port="9000"
|
||||
container_name="websoft9-apphub"
|
||||
volume_name="websoft9_apphub_config"
|
||||
|
||||
check_ports() {
|
||||
|
||||
local ports=("$@")
|
||||
for port in "${ports[@]}"; do
|
||||
echo "Check port: $port"
|
||||
if ss -tuln | grep ":$port " >/dev/null && ! systemctl status cockpit.socket | grep "$port" >/dev/null; then
|
||||
echo "Port $port is in use, can not set this port to config.ini"
|
||||
return 0
|
||||
fi
|
||||
done
|
||||
echo "All ports are available"
|
||||
return 1
|
||||
}
|
||||
|
||||
# get volume from container
|
||||
function get_volume_path() {
|
||||
local container_name="$1"
|
||||
@ -54,16 +40,13 @@ on_change() {
|
||||
cockpit_port=$(docker exec -i websoft9-apphub apphub getconfig --section cockpit --key port)
|
||||
listen_stream=$(grep -Po 'ListenStream=\K[0-9]*' /lib/systemd/system/cockpit.socket)
|
||||
if [ "$cockpit_port" != "$listen_stream" ]; then
|
||||
check_ports "$cockpit_port"
|
||||
if [ $? -eq 0 ]; then
|
||||
sudo docker exec -i websoft9-apphub apphub setconfig --section cockpit --key port --value "$listen_stream"
|
||||
else
|
||||
ex -s -c "g/ListenStream=${listen_stream}/s//ListenStream=${cockpit_port}/" -c wq "$cockpit_service_path"
|
||||
systemctl daemon-reload
|
||||
systemctl restart cockpit.socket 2> /dev/null
|
||||
systemctl restart cockpit || exit 1
|
||||
set_Firewalld
|
||||
fi
|
||||
|
||||
ex -s -c "g/ListenStream=${listen_stream}/s//ListenStream=${cockpit_port}/" -c wq "$cockpit_service_path"
|
||||
systemctl daemon-reload
|
||||
systemctl restart cockpit.socket 2> /dev/null
|
||||
systemctl restart cockpit || exit 1
|
||||
set_Firewalld
|
||||
|
||||
fi
|
||||
set -e
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
{
|
||||
"version": "2.1.17-rc1",
|
||||
"version": "2.1.17-rc2",
|
||||
"plugins": {
|
||||
"portainer": "0.1.3",
|
||||
"nginx": "0.1.0",
|
||||
|
Loading…
Reference in New Issue
Block a user