-
Notifications
You must be signed in to change notification settings - Fork 1
/
install.txt
114 lines (83 loc) · 3.67 KB
/
install.txt
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
WFArchiver
Copyright © 2018 Gary W Funk
V1.0.0
<!-- These instructions take 30 minutes to complete starting with a new SD Card -->
<!-- If you have MariaDB installed skip to MARIADB SETUP -->
<!-- Before you start, run the following two commands, THREE TIMES -->
sudo apt-get update
sudo apt-get dist-upgrade
sudo apt-get update
sudo apt-get dist-upgrade
sudo apt-get update
sudo apt-get dist-upgrade
<!-- Install MariaDB -->
sudo apt-get install mariadb-server
<!-- MARIADB SETUP -->
<!-- Edit the config file for MariaDB -->
sudo nano /etc/mysql/my.cnf
<!-- At the end of the file add the following two lines -->
[mysqld]
bind-address = 0.0.0.0
<!-- Save the file and exit ctrl-O <enter> ctrl-X -->
<!-- Restart MariaDB with the following -->
sudo /etc/init.d/mysql restart
<!-- Log into MariaDB to set the privileges and user -->
sudo mysql -u root -p
GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' IDENTIFIED BY '';
SET PASSWORD FOR 'root'@'localhost' = PASSWORD('');
UPDATE mysql.user SET AUTHENTICATION_STRING=PASSWORD(''), plugin='' WHERE User='root';
<!-- Create a user for yourself. Change 'UserName' to your login and 'PassWord' to your password
GRANT ALL PRIVILEGES ON *.* TO 'UserName'@'%' IDENTIFIED BY 'PassWord';
FLUSH PRIVILEGES;
QUIT;
<!-- WFARCHIVER SCRIPT SETUP-->
<!-- This script will install all the necessary file for you -->
wget -qO - http://wf.fsoft.com/wfarchiver/install.sh | bash -e
<!-- Run crontab and add to the end of the file -->
crontab -e
<enter>
<!-- add the following line to the end of the file -->
@reboot /usr/bin/forever start /home/pi/wfarchiver/forever.json
<!-- Save the file and exit ctrl-O <enter> ctrl-X -->
<!-- WFARCHIVER MANUAL SETUP-->
<!-- Skip all of this if you ran the script, -->
mkdir wfarchiver
cd wfarchiver
<!-- Install node.js -->
curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
sudo apt-get install -qy nodejs
node -v
sudo npm install forever -g
sudo wget -N http://wf.fsoft.com/wfarchiver/create-database-tables.js
sudo wget -N http://wf.fsoft.com/wfarchiver/air-daily-stats.js
sudo wget -N http://wf.fsoft.com/wfarchiver/sky-daily-stats.js
sudo wget -N http://wf.fsoft.com/wfarchiver/archive.js
sudo wget -N http://wf.fsoft.com/wfarchiver/forever.json
sudo wget -N http://wf.fsoft.com/wfarchiver/package.json
sudo npm install
node create-database-tables.js
<!-- end of script install -->
<!-- Reboot the PI and and check the database for data -->
<!-- USEFUL INFORMATION -->
<!-- If you get the following two lines and no errors, it's running -->
2018-04-04 22:53:43 Starting WFArchiver
2018-04-04 22:53:45 Listening on: 0.0.0.0:50222
<!-- It is also normal to see the following errors immediately after booting -->
<!-- This is beacause MariaDB is still starting -->
2018-04-04 22:53:45 MariaDB (1): Error: connect ECONNREFUSED 127.0.0.1:3306
2018-04-04 22:53:47 MariaDB (1): Error: connect ECONNREFUSED 127.0.0.1:3306
2018-04-04 22:53:47 Error(f): Cannot enqueue Query after fatal error.
2018-04-04 22:53:47 Error(f): Cannot enqueue Query after fatal error.
2018-04-04 22:53:48 Error(b): Cannot enqueue Query after fatal error.
<!-- To start the script -->
forever start forever.json
<!-- To stop the script -->
forever stop archive.js
<!-- To see what scripts are running -->
forever list
These scripts will collect and store the stats for today. You may run it several times each day. I suggest an hourly schedule.
daily-stats-air.js
daily-stats-sky.js
This will collect and store the stats for yesterday. You only need to run it once I suggest running it at 00:10 each day
daily-stats-air.js -date yesterday
daily-stats-sky.js -date yesterday