From d41b125dc27c0c310f2b4443965ac930c02ffdf3 Mon Sep 17 00:00:00 2001 From: xdrm-brackets Date: Tue, 9 May 2017 13:42:28 +0200 Subject: [PATCH] [fix] Deploy exclusivity --- lib/api/source/deploy.php | 3 --- lib/file/truncate | 12 ++++++------ 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/lib/api/source/deploy.php b/lib/api/source/deploy.php index 1f2a915..366ab3f 100755 --- a/lib/api/source/deploy.php +++ b/lib/api/source/deploy.php @@ -156,9 +156,6 @@ $saved = $saved < 0 ? 0 : $saved; // prevent negative /* (4) Truncate the log file */ - if( $saved > 0 ) - $saved++; // because need to be excluded - $truncated = syscall(SOURCE_DIR."/lib/file/truncate mfrc522 {$saved}"); /* (5) Manage error */ diff --git a/lib/file/truncate b/lib/file/truncate index f1348dc..5496834 100755 --- a/lib/file/truncate +++ b/lib/file/truncate @@ -12,22 +12,22 @@ source $__DIR__/../../lib/include/bash/func; # (1) If argument missing # if [ $# -lt 2 ]; then slog "Missing argument(s)" "file:truncate" "update"; - echo 128; - exit 128; + echo 127; + exit 127; fi; # (2) Check argument #1 # if [ ! -e "$DATA_DIR/$1" ]; then slog "Data file '$1' does not exist in '$DATA_DIR'" "file:truncate" "update"; - echo 129; - exit 129; + echo 127; + exit 127; fi; # (3) Check number of lines to truncate # if [ $2 -gt $(wc -l "$DATA_DIR/$1" | awk '{print $1}') ]; then slog "Failure: asked to remove $2 lines out of `wc -l "$DATA_DIR/$1" | awk '{print $1}'` lines" "file:truncate" "update"; - echo 130; - exit 130; + echo 127; + exit 127; fi;