mirror of
https://github.com/Zygo/bees.git
synced 2025-06-16 09:36:17 +02:00
Make filters configurable
Signed-off-by: Timofey Titovets <nefelim4ag@gmail.com>
This commit is contained in:
31
scripts/beesd
Normal file → Executable file
31
scripts/beesd
Normal file → Executable file
@ -50,6 +50,7 @@ BEESHOME="${BEESHOME:-$MNT_DIR/.beeshome}"
|
||||
BEESSTATUS="${BEESSTATUS:-$WORK_DIR/$UUID.status}"
|
||||
DB_SIZE="${DB_SIZE:-$((64*AL16M))}"
|
||||
LOG_SHORT_PATH="${LOG_SHORT_PATH:-N}"
|
||||
LOG_FILTER_TIME="${LOG_FILTER_TIME:-N}"
|
||||
|
||||
INFO "Check: BTRFS UUID exists"
|
||||
if [ ! -d "/sys/fs/btrfs/$UUID" ]; then
|
||||
@ -97,15 +98,29 @@ fi
|
||||
chmod 700 "$DB_PATH"
|
||||
}
|
||||
|
||||
filter_output(){
|
||||
sed -e 's/^.*crawl:/crawl:/g' \
|
||||
-e 's/^.*status:/status:/g' \
|
||||
-e 's/^.*bees:/bees:/g' \
|
||||
-e 's/^.*crawl_writeback:/crawl_writeback:/g' \
|
||||
-e 's/^.*main:/main:/g' \
|
||||
-e 's/^.*hash_prefetch:/hash_prefetch:/g'
|
||||
MNT_DIR="${MNT_DIR//\/\//\/}"
|
||||
|
||||
filter_time(){
|
||||
if YN $LOG_FILTER_TIME; then
|
||||
sed -e 's/^.*crawl:/crawl:/g' \
|
||||
-e 's/^.*status:/status:/g' \
|
||||
-e 's/^.*bees:/bees:/g' \
|
||||
-e 's/^.*crawl_writeback:/crawl_writeback:/g' \
|
||||
-e 's/^.*main:/main:/g' \
|
||||
-e 's/^.*hash_prefetch:/hash_prefetch:/g'
|
||||
else
|
||||
cat
|
||||
fi
|
||||
}
|
||||
|
||||
bees "$MNT_DIR" 3>&1 2>&1 | filter_output
|
||||
filter_path(){
|
||||
if YN $LOG_SHORT_PATH; then
|
||||
sed -e "s#$MNT_DIR##g"
|
||||
else
|
||||
cat
|
||||
fi
|
||||
}
|
||||
|
||||
bees "$MNT_DIR" 3>&1 2>&1 | filter_time | filter_path
|
||||
|
||||
exit 0
|
||||
|
Reference in New Issue
Block a user