mirror of
https://github.com/dotnet/MQTTnet.git
synced 2026-10-16 17:23:04 +08:00
18 lines
516 B
Bash
18 lines
516 B
Bash
#!/bin/bash
|
|
|
|
BASEPATH=/opt
|
|
INSTALLPATH=$BASEPATH/MQTTnetServer
|
|
|
|
# Check if systemctl exists, does not exist in docker containers
|
|
SCTL=$(which systemctl >/dev/null; echo $?)
|
|
if [ "$SCTL" -eq "0" ]; then
|
|
# Stop service before uninstalling
|
|
systemctl stop mqttnet-server
|
|
fi
|
|
|
|
# Check if setcap exists, does not exist in docker containers
|
|
SCAP=$(which setcap >/dev/null; echo $?)
|
|
if [ "$SCAP" -eq "0" ]; then
|
|
# Remove permission to open ports
|
|
setcap CAP_NET_BIND_SERVICE=-eip $INSTALLPATH/MQTTnet.Server
|
|
fi |