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
1 changed files with 6 additions and 1 deletions

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\"."