mirror of
				https://github.com/Zygo/bees.git
				synced 2025-11-03 19:50:34 +01: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
 | 
			
		||||
 
 | 
			
		||||
@@ -12,6 +12,12 @@ UUID=5d3c0ad5-bedf-463d-8235-b4d4f6f99476
 | 
			
		||||
# BEESHOME="$MNT_DIR/.beeshome"
 | 
			
		||||
# BEESSTATUS="$WORK_DIR/$UUID.status"
 | 
			
		||||
 | 
			
		||||
## Make path shorter in logs
 | 
			
		||||
# LOG_SHORT_PATH=N
 | 
			
		||||
 | 
			
		||||
## Remove timestamp from bees output
 | 
			
		||||
# LOG_FILTER_TIME=N
 | 
			
		||||
 | 
			
		||||
## Bees DB size
 | 
			
		||||
# Hash Table Sizing
 | 
			
		||||
# sHash table entries are 16 bytes each
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user