33 lines
667 B
Plaintext
33 lines
667 B
Plaintext
|
#!/bin/bash
|
||
|
|
||
|
|
||
|
# [1] Launches external script
|
||
|
####################################################
|
||
|
# $1 - dependency file
|
||
|
syscall(){
|
||
|
# (1) Check file #
|
||
|
test -z $1 && exit;
|
||
|
test ! -f $1 && exit;
|
||
|
|
||
|
# (2) Call and catch output #
|
||
|
OUT=$($1);
|
||
|
|
||
|
# (3) Clean output : remove leading/ending spaces #
|
||
|
OUT=$(echo $OUT | tr '\n' '\x' | sed 's/^[ \t\x]*//g' | tr '\x' '\n');
|
||
|
OUT=$(echo $OUT | tr '\n' '\x' | sed 's/[ \t\x]*$//g' | tr '\x' '\n');
|
||
|
|
||
|
# (4) Manage result #
|
||
|
return $OUT;
|
||
|
}
|
||
|
|
||
|
# [2] Log management
|
||
|
####################################################
|
||
|
# $1 - error message
|
||
|
# $2 - feature
|
||
|
# $3 - flag
|
||
|
slog(){
|
||
|
|
||
|
echo $(date +%s)." [$2] $1" >> $LOG_DIR."/$3.log";
|
||
|
|
||
|
}
|