Apply SKIP_SUDO when starting knockd (#2795)

This commit is contained in:
Anton Curanz 2024-04-26 23:09:19 +02:00 committed by GitHub
parent 1d57487766
commit 94c8a86c7c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -45,7 +45,12 @@ if isTrue "${DEBUG_AUTOPAUSE}"; then
knockdArgs+=(-D)
fi
sudo /usr/local/sbin/knockd "${knockdArgs[@]}"
if isTrue "${SKIP_SUDO}"; then
/usr/local/sbin/knockd "${knockdArgs[@]}"
else
sudo /usr/local/sbin/knockd "${knockdArgs[@]}"
fi
if [ $? -ne 0 ] ; then
logAutopause "Failed to start knockd daemon."
logAutopause "Probable cause: Unable to attach to interface \"$AUTOPAUSE_KNOCK_INTERFACE\"."