forked from gregelin/FCC-CDBS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cdbs_download_unix-sample.sh
executable file
·57 lines (43 loc) · 1.36 KB
/
cdbs_download_unix-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
#!/bin/tcsh -f
############################ template.sh ###########################
# Author Name | [email protected]
# Copyright 2011 Greg Elin
####################################################################
### Description ###
#
# This unix shell script automatically downloads FCC CDBS files.
# CDBS files are updated daily at 2:00 AM EST.
# This has been tested on Mac OS X.
### Properties ###
#
# These items must be modified to suit your environment before
# implementing this script!
#
#
set srcUrlPath = 'http://transition.fcc.gov/Bureaus/MB/Databases/cdbs/'
set srcFile = 'all-cdbs-files.zip'
set srcDownload = $srcUrlPath$srcFile
# Update path to directory on your computer to store
set trgDir = '/path/to/where/store/files/'
set trgFile = $trgDir$srcFile
set 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 "All done."