[fix] Deploy exclusivity
This commit is contained in:
parent
8e70aea830
commit
d41b125dc2
|
@ -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 */
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue