-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcheckls.sh
More file actions
59 lines (50 loc) · 1 KB
/
checkls.sh
File metadata and controls
59 lines (50 loc) · 1 KB
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
#!/bin/bash
c=0
prog=$$
sitename=("LawSmart" "LawInfo" "LawInfo-Legal-Marketing" "Lead-Counsel" "LawInfo-Blog")
siteurl=(
"http://www.lawsmart.com"
"http://www.lawinfo.com"
"http://www.lawinfo.com/legal-marketing/"
"http://www.leadcounsel.org"
"http://blog.lawinfo.com"
)
tput civis
function restore() {
tput cnorm
echo ""
kill $! > /dev/null 2>&1
kill -s 9 $$ > /dev/null 2>&1
}
function checkSite() {
lsite=$(wget --server-response --spider -t 1 "$1" 2>&1 | grep 'HTTP/')
code=${lsite:11:${#lsite}}
echo -n " $code"
echo ""
}
trap restore SIGINT SIGKILL
function checkStatus() {
prog=$$
checkSite "$1" &
csid=$!
for i in `seq ${#1} 10000`;
do
ss=$(( ${i} / 5 ))
s=$(printf "%-${ss}s" "[")
c=$(( ${i} * 10 ))
if ! kill -0 $csid > /dev/null 2>&1;
then
break;
fi
echo -ne "\r${s// /=}"
echo -n "[${c}ms]"
echo -n ">"
sleep 0.01s
done
echo ""
}
for w in `seq 0 $(( ${#sitename[@]} - 1 ))`;
do
echo "[${sitename[${w}]}] : ${siteurl[${w}]}"
checkStatus "${siteurl[${w}]}"
done