tabularize auto-pager
[hband-tools.git] / admin-tools / xinetd-stats
blob9f517fbdf2f50363afee3cb21b5f6b7fee150b39
1 #!/bin/bash
3 stdbuf -oL tail -n 0 -v -F /var/run/xinetd.dump |\
5 pass=''
6 while IFS='' read -r line
7 do
8 if [[ $line =~ ^==\> ]]
9 then
10 # tail opened the file, it's time to ask xinetd to dump
11 pkill -USR1 -F /var/run/xinetd.pid
13 if [[ $line =~ ^INTERNAL\ STATE\ DUMP ]]
14 then
15 pass=1
17 if [ $pass ]
18 then
19 printf "%s\n" "$line"
21 if [[ $line =~ ^END\ OF\ DUMP ]]
22 then
23 pass=''
24 break
26 done
28 # we got enough data, terminate tail
29 pipekill 0