Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
CryptoCurrencyTracker
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
rs11g21
CryptoCurrencyTracker
Commits
6298843f
Commit
6298843f
authored
2 years ago
by
rs11g21
Browse files
Options
Downloads
Patches
Plain Diff
Able to handle error if xampp is not connected to internet
parent
941b9f94
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
insertDataBitcoinUpdated3.sh
+66
-0
66 additions, 0 deletions
insertDataBitcoinUpdated3.sh
with
66 additions
and
0 deletions
insertDataBitcoinUpdated3.sh
0 → 100644
+
66
−
0
View file @
6298843f
#! /usr/bin/bash
if
[
"
$(
curl
-s
-o
/dev/null
-w
"%{http_code}"
http://www.google.com/
)
"
-eq
"200"
]
;
then
echo
"XAMPP's Apache server is connected to the internet."
awk
-F
':'
'{
if(/BitCoin Value/){
cmd = "/opt/lampp/bin/mysql -u root -e \"USE cryptoTracker; INSERT INTO cryptoPrice(cryptoID,value,collected) VALUES (1, " $2 ",'
\'
'" strftime("%Y-%m-%d %H:%M:%S") "'
\'
')\""
system(cmd)
}else if(/BitCoin 24 Hour Low/){
cmd = "/opt/lampp/bin/mysql -u root -e \"USE cryptoTracker; INSERT INTO lowPrice(cryptoID,value,collected) VALUES (1, " $2 ",'
\'
'" strftime("%Y-%m-%d %H:%M:%S") "'
\'
')\""
system(cmd)
}else if(/BitCoin 24 Hour High/){
cmd = "/opt/lampp/bin/mysql -u root -e \"USE cryptoTracker; INSERT INTO highPrice(cryptoID,value,collected) VALUES (1, " $2 ",'
\'
'" strftime("%Y-%m-%d %H:%M:%S") "'
\'
')\""
system(cmd)
}else if(/BitCoin 24 Hour Open/){
cmd = "/opt/lampp/bin/mysql -u root -e \"USE cryptoTracker; INSERT INTO openPrice(cryptoID,value,collected) VALUES (1, " $2 ",'
\'
'" strftime("%Y-%m-%d %H:%M:%S") "'
\'
')\""
system(cmd)
}else if(/BitCoin Market Cap/){
cmd = "/opt/lampp/bin/mysql -u root -e \"USE cryptoTracker; INSERT INTO marketCap(cryptoID,value,collected) VALUES (1, " $2 ",'
\'
'" strftime("%Y-%m-%d %H:%M:%S") "'
\'
')\""
system(cmd)
}else if(/BitCoin Change In Value/){
cmd = "/opt/lampp/bin/mysql -u root -e \"USE cryptoTracker; INSERT INTO changeInValue(cryptoID,value,collected) VALUES (1, " $2 ",'
\'
'" strftime("%Y-%m-%d %H:%M:%S") "'
\'
')\""
system(cmd)
}else if(/BitCoin Return Percentage/){
cmd = "/opt/lampp/bin/mysql -u root -e \"USE cryptoTracker; INSERT INTO returnPercentage(cryptoID,value,collected) VALUES (1, " $2 ",'
\'
'" strftime("%Y-%m-%d %H:%M:%S") "'
\'
')\""
system(cmd)
}else if(/BitCoin Volatility/){
cmd = "/opt/lampp/bin/mysql -u root -e \"USE cryptoTracker; INSERT INTO volatility(cryptoID,value,collected) VALUES (1, " $2 ",'
\'
'" strftime("%Y-%m-%d %H:%M:%S") "'
\'
')\""
system(cmd)
}else if(/BitCoin 24 H Transaction Count/){
cmd = "/opt/lampp/bin/mysql -u root -e \"USE cryptoTracker; INSERT INTO transactionCount(cryptoID,value,collected) VALUES (1, " $2 ",'
\'
'" strftime("%Y-%m-%d %H:%M:%S") "'
\'
')\""
system(cmd)
}else if(/BitCoin Transaction Fee/){
cmd = "/opt/lampp/bin/mysql -u root -e \"USE cryptoTracker; INSERT INTO transactionFee(cryptoID,value,collected) VALUES (1, " $2 ",'
\'
'" strftime("%Y-%m-%d %H:%M:%S") "'
\'
')\""
system(cmd)
}
}'
< /dev/stdin
else
echo
"XAMPP's Apache server is not connected to the internet."
fi
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment