-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathfind-brr
executable file
·53 lines (43 loc) · 921 Bytes
/
find-brr
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/usr/bin/env bash
#
# Synopsis:
# Find active blob request log files across all schemas
# Usage:
# wc -l $(find-brr)
# Note:
# The output path ought to be relative to the current directory,
# enabling execution in any directory.
#
PROG=find-brr
# match: <schema>-1455329936.brr. expires 2038.
ROLLED_BRR_PAT='*-[1-4][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9].brr'
die()
{
echo "$PROG: ERROR: $@" >&2
exit 1
}
test -n "$SETSPACE_ROOT" || die 'environment var not defined: SETSPACE_ROOT'
cd $SETSPACE_ROOT || die "cd $SETSPACE_ROOT failed"
. etc/profile
found_brr()
{
local SPOOL=schema/$1/spool
test -d $SPOOL || return
find schema/$1/spool \
-maxdepth 1 \
-name '*.brr' \
! -name $ROLLED_BRR_PAT \
-print
}
case $# in
0)
find-schema | while read SCH; do
found_brr $SCH
done
;;
*)
echo $@ | sed 's/ */\n/g' | while read SCH; do
found_brr $SCH
done
;;
esac