-
Notifications
You must be signed in to change notification settings - Fork 0
/
count.sh
112 lines (86 loc) · 2.88 KB
/
count.sh
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
#!/bin/bash
# CONTRIBUTION
## Author: Tom Sapletta
## Created Date: 03.05.2022
# EXAMPLE
# ./count.sh pl
# ./count.sh net
# CONFIG
TLD=$1
[ -z "$TLD" ] && TLD="com"
YESTERDAY=$(date -d "yesterday" '+%Y-%m-%d')
CURRENTDATE=`date +"%Y-%m-%d"`
WHOIS_FOLDER="output"
WHOIS_TODAY_FOLDER="$WHOIS_FOLDER/$CURRENTDATE"
WHOIS_TODAY_EXPIRE_FOLDER="$WHOIS_TODAY_FOLDER/expire"
WHOIS_TODAY_FREE_FOLDER="$WHOIS_TODAY_FOLDER/free"
WHOIS_TODAY_BLOCKED_FOLDER="$WHOIS_TODAY_FOLDER/blocked"
WHOIS_TODAY_ERROR_FOLDER="$WHOIS_TODAY_FOLDER/error"
#
WHOIS_ARCHIVE_FOLDER="$WHOIS_FOLDER/$YESTERDAY"
WHOIS_ARCHIVE_EXPIRE_FOLDER="$WHOIS_ARCHIVE_FOLDER/expire"
WHOIS_ARCHIVE_FREE_FOLDER="$WHOIS_ARCHIVE_FOLDER/free"
WHOIS_ARCHIVE_BLOCKED_FOLDER="$WHOIS_ARCHIVE_FOLDER/blocked"
WHOIS_ARCHIVE_ERROR_FOLDER="$WHOIS_ARCHIVE_FOLDER/error"
# START
echo "TODAY:"
COUNT_FILES=$(find $WHOIS_TODAY_FOLDER -iname "*.$TLD.txt" -type f | wc -l)
echo "$TLD: $COUNT_FILES"
COUNT_FILES=$(ls "$WHOIS_TODAY_FOLDER" | wc -l)
echo "ALL: $COUNT_FILES"
echo ""
echo "FREE:"
COUNT_FILES=$(find $WHOIS_TODAY_FREE_FOLDER -iname "*.$TLD.txt" -type f | wc -l)
echo "$TLD: $COUNT_FILES"
COUNT_FILES=$(ls "$WHOIS_TODAY_FREE_FOLDER" | wc -l)
echo "ALL: $COUNT_FILES"
echo ""
echo "EXPIRE:"
COUNT_FILES=$(find $WHOIS_TODAY_EXPIRE_FOLDER -iname "*.$TLD.txt" -type f | wc -l)
echo "$TLD: $COUNT_FILES"
COUNT_FILES=$(ls "$WHOIS_TODAY_EXPIRE_FOLDER" | wc -l)
echo "ALL: $COUNT_FILES"
echo ""
echo "BLOCKED:"
COUNT_FILES=$(find $WHOIS_TODAY_BLOCKED_FOLDER -iname "*.$TLD.txt" -type f | wc -l)
echo "$TLD: $COUNT_FILES"
COUNT_FILES=$(ls "$WHOIS_TODAY_BLOCKED_FOLDER" | wc -l)
echo "ALL: $COUNT_FILES"
echo ""
echo "ERROR:"
COUNT_FILES=$(find $WHOIS_TODAY_ERROR_FOLDER -iname "*.$TLD.txt" -type f | wc -l)
echo "$TLD: $COUNT_FILES"
COUNT_FILES=$(ls "$WHOIS_TODAY_ERROR_FOLDER" | wc -l)
echo "ALL: $COUNT_FILES"
echo ""
echo ""
echo "YESTERDAY:"
COUNT_FILES=$(find $WHOIS_ARCHIVE_FOLDER -iname "*.$TLD.txt" -type f | wc -l)
echo "$TLD: $COUNT_FILES"
COUNT_FILES=$(ls "$WHOIS_ARCHIVE_FOLDER" | wc -l)
echo "ALL: $COUNT_FILES"
echo ""
echo "FREE:"
COUNT_FILES=$(find $WHOIS_ARCHIVE_FREE_FOLDER -iname "*.$TLD.txt" -type f | wc -l)
echo "$TLD: $COUNT_FILES"
COUNT_FILES=$(ls "$WHOIS_ARCHIVE_FREE_FOLDER" | wc -l)
echo "ALL: $COUNT_FILES"
echo ""
echo "EXPIRE:"
COUNT_FILES=$(find $WHOIS_ARCHIVE_EXPIRE_FOLDER -iname "*.$TLD.txt" -type f | wc -l)
echo "$TLD: $COUNT_FILES"
COUNT_FILES=$(ls "$WHOIS_ARCHIVE_EXPIRE_FOLDER" | wc -l)
echo "ALL: $COUNT_FILES"
echo ""
echo "BLOCKED:"
COUNT_FILES=$(find $WHOIS_ARCHIVE_BLOCKED_FOLDER -iname "*.$TLD.txt" -type f | wc -l)
echo "$TLD: $COUNT_FILES"
COUNT_FILES=$(ls "$WHOIS_ARCHIVE_BLOCKED_FOLDER" | wc -l)
echo "ALL: $COUNT_FILES"
echo ""
echo "ERROR:"
COUNT_FILES=$(find $WHOIS_ARCHIVE_ERROR_FOLDER -iname "*.$TLD.txt" -type f | wc -l)
echo "$TLD: $COUNT_FILES"
COUNT_FILES=$(ls "$WHOIS_ARCHIVE_ERROR_FOLDER" | wc -l)
echo "ALL: $COUNT_FILES"
echo ""