1
0
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:
Timofey Titovets
2016-12-30 04:26:42 +03:00
parent badfa6e9b9
commit 22e601912e
2 changed files with 29 additions and 8 deletions

31
scripts/beesd Normal file → Executable file
View 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