-
Notifications
You must be signed in to change notification settings - Fork 7
/
cdbs_download_linux-sample.sh
executable file
·61 lines (46 loc) · 1.38 KB
/
cdbs_download_linux-sample.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
#!/bin/bash
############################ template.sh ###########################
# Author Name | [email protected]
# Copyright 2011 Greg Elin
####################################################################
### Description ###
#
# This Linux shell script automatically downloads FCC CDBS files.
# CDBS files are updated daily at 2:00 AM EST.
# This has been tested on Ubuntu Server.
### Properties ###
#
# These items must be modified to suit your environment before
# implementing this script!
#
#
srcUrlPath='http://transition.fcc.gov/Bureaus/MB/Databases/cdbs/'
srcFile='all-cdbs-files.zip'
srcDownload=$srcUrlPath$srcFile
# Update path to directory on your computer to store
trgDir='cdbs_files/'
trgFile=$trgDir$srcFile
defVar2=value
echo ""
echo "Downloading CDBS files $srcDownload"
echo ""
curl $srcDownload > $trgFile
echo ""
echo "$trgFile file written."
echo "Unzipping into $trgDir."
unzip -ao $trgFile -d $trgDir
echo ""
echo "Removing into $trgFile."
rm $trgFile
echo ""
echo "Create MySQL tables"
# Update the line with your MySQL 'username' and 'password'
mysql -v -uusername -ppassword cdbs < fcc_cdbs_ddl_mysql.sql
echo ""
echo "Load data into MySQL tables"
# Update the line with your MySQL 'username' and 'password'
mysql -v -uusername -ppassword cdbs < fcc_cdbs_load_mysql.sql
echo ""
echo "Removing all .dat files from $trgDir"
rm $trgDir*.dat
echo "All done."