-
Notifications
You must be signed in to change notification settings - Fork 0
/
initweb.bash
executable file
·30 lines (27 loc) · 1.2 KB
/
initweb.bash
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
#!/bin/bash
# Creates analysis results for the past five days
# provide historical data for script webserver/updatehistdata
# Used when installing fresh
#set -x
FOLDER="webserver"
DATES="`date -u --date="1 days ago" +%Y%m%d` `date -u --date="2 days ago" +%Y%m%d`\
`date -u --date="3 days ago" +%Y%m%d` `date -u --date="4 days ago" +%Y%m%d`\
`date -u --date="5 days ago" +%Y%m%d` `date -u --date="6 days ago" +%Y%m%d`\
`date -u --date="7 days ago" +%Y%m%d` `date -u --date="8 days ago" +%Y%m%d`\
`date -u --date="9 days ago" +%Y%m%d` `date -u --date="10 days ago" +%Y%m%d`"
echo "Creating historical analysis results for:" $DATES
for date in $DATES; do
echo "Downloading RBN data for:" $date
wget --quiet --no-hsts http://www.reversebeacon.net/raw_data/dl.php?f=$date -O $FOLDER/rbndata.zip
FILESIZE=$(stat -c%s $FOLDER/rbndata.zip)
if [[ $FILESIZE != "0" ]]; then
gunzip < $FOLDER/rbndata.zip > $FOLDER/rbndata.csv
echo "Downloaded "$((`wc -l < $FOLDER/rbndata.csv` - 2))" spots."
./rbnskew -wq -f $FOLDER/rbndata.csv > $FOLDER/$date.txt
echo "Analysis done, result saved in" $FOLDER/$date.txt
else
echo "Failed to download RBN data"
exit
fi
done
exit