[fix] Deploy exclusivity
This commit is contained in:
parent
8e70aea830
commit
d41b125dc2
|
@ -156,9 +156,6 @@
|
||||||
$saved = $saved < 0 ? 0 : $saved; // prevent negative
|
$saved = $saved < 0 ? 0 : $saved; // prevent negative
|
||||||
|
|
||||||
/* (4) Truncate the log file */
|
/* (4) Truncate the log file */
|
||||||
if( $saved > 0 )
|
|
||||||
$saved++; // because need to be excluded
|
|
||||||
|
|
||||||
$truncated = syscall(SOURCE_DIR."/lib/file/truncate mfrc522 {$saved}");
|
$truncated = syscall(SOURCE_DIR."/lib/file/truncate mfrc522 {$saved}");
|
||||||
|
|
||||||
/* (5) Manage error */
|
/* (5) Manage error */
|
||||||
|
|
|
@ -12,22 +12,22 @@ source $__DIR__/../../lib/include/bash/func;
|
||||||
# (1) If argument missing #
|
# (1) If argument missing #
|
||||||
if [ $# -lt 2 ]; then
|
if [ $# -lt 2 ]; then
|
||||||
slog "Missing argument(s)" "file:truncate" "update";
|
slog "Missing argument(s)" "file:truncate" "update";
|
||||||
echo 128;
|
echo 127;
|
||||||
exit 128;
|
exit 127;
|
||||||
fi;
|
fi;
|
||||||
|
|
||||||
# (2) Check argument #1 #
|
# (2) Check argument #1 #
|
||||||
if [ ! -e "$DATA_DIR/$1" ]; then
|
if [ ! -e "$DATA_DIR/$1" ]; then
|
||||||
slog "Data file '$1' does not exist in '$DATA_DIR'" "file:truncate" "update";
|
slog "Data file '$1' does not exist in '$DATA_DIR'" "file:truncate" "update";
|
||||||
echo 129;
|
echo 127;
|
||||||
exit 129;
|
exit 127;
|
||||||
fi;
|
fi;
|
||||||
|
|
||||||
# (3) Check number of lines to truncate #
|
# (3) Check number of lines to truncate #
|
||||||
if [ $2 -gt $(wc -l "$DATA_DIR/$1" | awk '{print $1}') ]; then
|
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";
|
slog "Failure: asked to remove $2 lines out of `wc -l "$DATA_DIR/$1" | awk '{print $1}'` lines" "file:truncate" "update";
|
||||||
echo 130;
|
echo 127;
|
||||||
exit 130;
|
exit 127;
|
||||||
fi;
|
fi;
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue