Updated log function/bash (default values) + use in update
This commit is contained in:
parent
d4b14c1d02
commit
390312ad41
|
@ -27,6 +27,14 @@ syscall(){
|
||||||
# $3 - flag
|
# $3 - flag
|
||||||
slog(){
|
slog(){
|
||||||
|
|
||||||
echo $(date +%s)." [$2] $1" >> $LOG_DIR."/$3.log";
|
test -z "$1" && msg="unknown error" || msg="$1";
|
||||||
|
test -z "$2" && feature="main" || feature="$2";
|
||||||
|
test -z "$3" && flag="daemon" || flag="$3";
|
||||||
|
|
||||||
|
test "$msg" = "-" && msg="unknown error" || msg="$1";
|
||||||
|
test "$feature" = "-" && feature="main" || feature="$2";
|
||||||
|
test "$flag" = "-" && flag="daemon" || flag="$3";
|
||||||
|
|
||||||
|
echo "$(date +%s) [$feature] $msg" >> $LOG_DIR/$flag.log;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
2
update
2
update
|
@ -6,7 +6,7 @@ source $__DIR__/lib/include/bash/const;
|
||||||
source $__DIR__/lib/include/bash/func;
|
source $__DIR__/lib/include/bash/func;
|
||||||
|
|
||||||
# [1] Send data + fetch configuration
|
# [1] Send data + fetch configuration
|
||||||
$SOURCE_DIR/lib/api/sync;
|
test $($SOURCE_DIR/lib/api/sync) -eq 127 && slog "sync failed" - "update" && exit;
|
||||||
|
|
||||||
test $? -ne 0 && exit 127;
|
test $? -ne 0 && exit 127;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue