mirror of
https://github.com/dotnet/MQTTnet.git
synced 2026-10-20 11:45:43 +08:00
@@ -9,12 +9,12 @@ INSTALLPATH=$BASEPATH/MQTTnetServer
|
|||||||
|
|
||||||
# If user does not exist, create it
|
# If user does not exist, create it
|
||||||
if (( $USEREXISTS == 1 )); then
|
if (( $USEREXISTS == 1 )); then
|
||||||
useradd -d $INSTALLPATH -r $USER
|
useradd -d $INSTALLPATH -r $USER
|
||||||
EC=$(echo $?)
|
EC=$(echo $?)
|
||||||
|
|
||||||
if (( $EC == 1 )); then
|
if (( $EC == 1 )); then
|
||||||
exit 1;
|
exit 1;
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Set permissions on files
|
# Set permissions on files
|
||||||
@@ -30,5 +30,10 @@ setcap CAP_NET_BIND_SERVICE=+eip $INSTALLPATH/MQTTnet.Server
|
|||||||
|
|
||||||
chmod 644 /etc/systemd/system/mqttnet-server.service
|
chmod 644 /etc/systemd/system/mqttnet-server.service
|
||||||
|
|
||||||
# Reload systemd because of new service file
|
# Check if systemctl exists, does not exist in docker containers
|
||||||
systemctl daemon-reload
|
SCTL=$(which systemctl >/dev/null; echo $?)
|
||||||
|
|
||||||
|
if [ "$SCTL" -eq "0" ]; then
|
||||||
|
# Reload systemd because of new service file
|
||||||
|
systemctl daemon-reload
|
||||||
|
fi
|
||||||
@@ -1,4 +1,9 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# Reload systemd because of absent service file
|
# Check if systemctl exists, does not exist in docker containers
|
||||||
systemctl daemon-reload
|
SCTL=$(which systemctl >/dev/null; echo $?)
|
||||||
|
|
||||||
|
if [ "$SCTL" -eq "0" ]; then
|
||||||
|
# Reload systemd because of new service file
|
||||||
|
systemctl daemon-reload
|
||||||
|
fi
|
||||||
@@ -3,8 +3,13 @@
|
|||||||
BASEPATH=/opt
|
BASEPATH=/opt
|
||||||
INSTALLPATH=$BASEPATH/MQTTnetServer
|
INSTALLPATH=$BASEPATH/MQTTnetServer
|
||||||
|
|
||||||
# Stop service before uninstalling
|
# Check if systemctl exists, does not exist in docker containers
|
||||||
systemctl stop mqttnet-server
|
SCTL=$(which systemctl >/dev/null; echo $?)
|
||||||
|
|
||||||
|
if [ "$SCTL" -eq "0" ]; then
|
||||||
|
# Stop service before uninstalling
|
||||||
|
systemctl stop mqttnet-server
|
||||||
|
fi
|
||||||
|
|
||||||
# Remove permission to open ports
|
# Remove permission to open ports
|
||||||
setcap CAP_NET_BIND_SERVICE=-eip $INSTALLPATH/MQTTnet.Server
|
setcap CAP_NET_BIND_SERVICE=-eip $INSTALLPATH/MQTTnet.Server
|
||||||
Reference in New Issue
Block a user