fix upgrade when somthing is already listening on 8080 (#1258)
* this should fix issue #1245 * change cmdline for getting port Co-authored-by: sabban <15465465+sabban@users.noreply.github.com>
This commit is contained in:
parent
1d156ab19d
commit
afe1704aa6
1
debian/control
vendored
1
debian/control
vendored
|
@ -5,3 +5,4 @@ Build-Depends: debhelper, jq, bash, git
|
||||||
Package: crowdsec
|
Package: crowdsec
|
||||||
Architecture: any
|
Architecture: any
|
||||||
Description: Crowdsec - An open-source, lightweight agent to detect and respond to bad behaviours. It also automatically benefits from our global community-wide IP reputation database
|
Description: Crowdsec - An open-source, lightweight agent to detect and respond to bad behaviours. It also automatically benefits from our global community-wide IP reputation database
|
||||||
|
Depends: coreutils
|
5
debian/postinst
vendored
5
debian/postinst
vendored
|
@ -89,10 +89,11 @@ if [ "$1" = configure ]; then
|
||||||
|
|
||||||
systemctl --quiet is-enabled crowdsec || systemctl unmask crowdsec && systemctl enable crowdsec
|
systemctl --quiet is-enabled crowdsec || systemctl unmask crowdsec && systemctl enable crowdsec
|
||||||
|
|
||||||
if [ -z "$(ss -nlt 'sport = 8080' | grep -v ^State)" ] || [ "$LAPI" = false ]; then
|
PORT=$(cscli config show --key "Config.API.Server.ListenURI"|cut -d ":" -f2)
|
||||||
|
if [ -z "$(ss -nlt "sport = ${PORT}" | grep -v ^State)" ] || [ "$LAPI" = false ] ; then
|
||||||
systemctl start crowdsec
|
systemctl start crowdsec
|
||||||
else
|
else
|
||||||
echo "Not attempting to start crowdsec, port 8080 is already used or lapi was disabled"
|
echo "Not attempting to start crowdsec, port ${PORT} is already used or lapi was disabled"
|
||||||
echo "This port is configured through /etc/crowdsec/config.yaml and /etc/crowdsec/local_api_credentials.yaml"
|
echo "This port is configured through /etc/crowdsec/config.yaml and /etc/crowdsec/local_api_credentials.yaml"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in a new issue