naywatch: fix mode without watchdog
authorNick Hainke <vincent@systemli.org>
Thu, 13 Jan 2022 07:46:31 +0000 (08:46 +0100)
committerNick Hainke <vincent@systemli.org>
Thu, 13 Jan 2022 07:56:32 +0000 (08:56 +0100)
The if-condition was always evaluated to be true.

Signed-off-by: Nick Hainke <vincent@systemli.org>
naywatch/files/naywatch.sh

index 8eea429d7ae4a066d159cabb8499376d7efcf933..e6d2fb75fce61e4f8d6ab6a10b2ea3c38d23032d 100644 (file)
@@ -71,7 +71,7 @@ no_neighbors() {
         return 0
     fi
 
-    if [ $SAVE_LOGS ]; then
+    if [ $SAVE_LOGS -eq 1 ]; then
         log "Saving Logs!"
         write_logs
     fi
@@ -85,18 +85,18 @@ log "Naywatch Started!"
 
 neighbors() {
     ACTIVE=1
-    if [ $USE_WATCHDOG ]; then
+    if [ $USE_WATCHDOG -eq 1 ]; then
         echo 1 >&3
     fi
 }
 
 not_active() {
-    if [ $USE_WATCHDOG ]; then
+    if [ $USE_WATCHDOG -eq 1 ]; then
         echo 1 >&3
     fi 
 }
 
-if [ $USE_WATCHDOG ]; then
+if [ $USE_WATCHDOG -eq 1 ]; then
     activate_watchdog
 fi