-
Notifications
You must be signed in to change notification settings - Fork 1
/
quake
executable file
·34 lines (32 loc) · 922 Bytes
/
quake
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
#!/bin/sh
#
# curls the last quakes in the world and re-checks it every five seconds to see
# if anything else happens.
#
# POSSIBLE BUG: if it's a really huge earthquake that rips the Earth's crust
# and/or the fabric of space-time in half, this script could be interrupted
# prior to entering the next loop (perhaps my living room just exploded, for
# example).
url='http://earthquake.usgs.gov/earthquakes/catalogs/eqs1hour-M0.txt'
chsum1=`curl --silent $url | sed -n 2p | md5`
chsum2=$chsum1
while [ 1 ]
do
chsum2=`curl --silent $url | sed -n 2p`
if [ "$chsum2" != "" ]
then
chsum2=`echo $chsum2 | md5`
if [ "$chsum1" == "$chsum2" ]
then
echo "None yet! We're still alive!"
else
echo "Holy shit! A fucking earthquake!"
say "Holy shit! A fucking earthquake!"
cd 2-vagrant && vagrant up
exit 0
fi
else
echo "None yet! We're still alive!"
fi
sleep 5
done