Cleanup and clarifications
This commit is contained in:
@@ -1,224 +0,0 @@
|
|||||||
-- MySQL dump 10.15 Distrib 10.0.12-MariaDB, for debian-linux-gnu (armv6l)
|
|
||||||
--
|
|
||||||
-- Host: localhost Database: WellData
|
|
||||||
-- ------------------------------------------------------
|
|
||||||
-- Server version 10.0.12-MariaDB-1~wheezy-log
|
|
||||||
|
|
||||||
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
|
|
||||||
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
|
|
||||||
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
|
|
||||||
/*!40101 SET NAMES utf8 */;
|
|
||||||
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
|
|
||||||
/*!40103 SET TIME_ZONE='+00:00' */;
|
|
||||||
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
|
|
||||||
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
|
|
||||||
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
|
|
||||||
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Table structure for table `Event_List`
|
|
||||||
--
|
|
||||||
CREATE DATABASE IF NOT EXISTS WellData;
|
|
||||||
USE WellData;
|
|
||||||
DROP TABLE IF EXISTS `Event_List`;
|
|
||||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
|
||||||
/*!40101 SET character_set_client = utf8 */;
|
|
||||||
CREATE TABLE `Event_List` (
|
|
||||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
|
||||||
`device_name` varchar(45) DEFAULT NULL,
|
|
||||||
`type` varchar(45) DEFAULT NULL,
|
|
||||||
`cond` varchar(45) DEFAULT NULL,
|
|
||||||
`value` float DEFAULT NULL,
|
|
||||||
`datetime` datetime DEFAULT NULL,
|
|
||||||
`tag` varchar(45) DEFAULT NULL,
|
|
||||||
`stroke_number` int(16) DEFAULT NULL,
|
|
||||||
PRIMARY KEY (`id`)
|
|
||||||
) ENGINE=InnoDB AUTO_INCREMENT=55 DEFAULT CHARSET=latin1;
|
|
||||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Dumping data for table `Event_List`
|
|
||||||
--
|
|
||||||
|
|
||||||
LOCK TABLES `Event_List` WRITE;
|
|
||||||
/*!40000 ALTER TABLE `Event_List` DISABLE KEYS */;
|
|
||||||
/*!40000 ALTER TABLE `Event_List` ENABLE KEYS */;
|
|
||||||
UNLOCK TABLES;
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Table structure for table `Hist_Day`
|
|
||||||
--
|
|
||||||
|
|
||||||
DROP TABLE IF EXISTS `Hist_Day`;
|
|
||||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
|
||||||
/*!40101 SET character_set_client = utf8 */;
|
|
||||||
CREATE TABLE `Hist_Day` (
|
|
||||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
|
||||||
`gauge_date` datetime DEFAULT NULL,
|
|
||||||
`percent_run` float DEFAULT NULL,
|
|
||||||
`kWh` float DEFAULT NULL,
|
|
||||||
`electricity_cost` float DEFAULT NULL,
|
|
||||||
`peak_load` float DEFAULT NULL,
|
|
||||||
`min_load` float DEFAULT NULL,
|
|
||||||
`average_SPM` float DEFAULT NULL,
|
|
||||||
`production_calculated` float DEFAULT NULL,
|
|
||||||
`full_card_production` float DEFAULT NULL,
|
|
||||||
`polished_rod_HP` float DEFAULT NULL,
|
|
||||||
`lifting_cost` float DEFAULT NULL,
|
|
||||||
`fluid_above_pump` float DEFAULT NULL,
|
|
||||||
`pump_intake_pressure` float DEFAULT NULL,
|
|
||||||
`kWh_regen` float DEFAULT NULL,
|
|
||||||
`inflow_rate` float DEFAULT NULL,
|
|
||||||
PRIMARY KEY (`id`)
|
|
||||||
) ENGINE=InnoDB AUTO_INCREMENT=79 DEFAULT CHARSET=latin1;
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Dumping data for table `Hist_Day`
|
|
||||||
--
|
|
||||||
|
|
||||||
LOCK TABLES `Hist_Day` WRITE;
|
|
||||||
/*!40000 ALTER TABLE `Hist_Day` DISABLE KEYS */;
|
|
||||||
/*!40000 ALTER TABLE `Hist_Day` ENABLE KEYS */;
|
|
||||||
UNLOCK TABLES;
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Table structure for table `Well_Test`
|
|
||||||
--
|
|
||||||
|
|
||||||
DROP TABLE IF EXISTS `Well_Test`;
|
|
||||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
|
||||||
/*!40101 SET character_set_client = utf8 */;
|
|
||||||
CREATE TABLE `Well_Test` (
|
|
||||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
|
||||||
`test_date` datetime DEFAULT NULL,
|
|
||||||
`test_volume_oil` float DEFAULT NULL,
|
|
||||||
`test_volume_water` float DEFAULT NULL,
|
|
||||||
`test_volume_gas` float DEFAULT NULL,
|
|
||||||
`k_factor` float DEFAULT NULL,
|
|
||||||
`projected_volume_oil` float DEFAULT NULL,
|
|
||||||
`projected_volume_water` float DEFAULT NULL,
|
|
||||||
`api_gravity_oil` float DEFAULT NULL,
|
|
||||||
`sg_oil` float DEFAULT NULL,
|
|
||||||
`sg_water` float DEFAULT NULL,
|
|
||||||
`test_hours` int(11) DEFAULT NULL,
|
|
||||||
PRIMARY KEY (`id`)
|
|
||||||
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1;
|
|
||||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Dumping data for table `Well_Test`
|
|
||||||
--
|
|
||||||
|
|
||||||
LOCK TABLES `Well_Test` WRITE;
|
|
||||||
/*!40000 ALTER TABLE `Well_Test` DISABLE KEYS */;
|
|
||||||
/*!40000 ALTER TABLE `Well_Test` ENABLE KEYS */;
|
|
||||||
UNLOCK TABLES;
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Table structure for table `config`
|
|
||||||
--
|
|
||||||
|
|
||||||
DROP TABLE IF EXISTS `config`;
|
|
||||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
|
||||||
/*!40101 SET character_set_client = utf8 */;
|
|
||||||
CREATE TABLE `config` (
|
|
||||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
|
||||||
`device_type` varchar(45) DEFAULT NULL,
|
|
||||||
`ip_address` varchar(45) DEFAULT NULL,
|
|
||||||
`dateChanged` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
|
|
||||||
PRIMARY KEY (`id`)
|
|
||||||
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1;
|
|
||||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Dumping data for table `config`
|
|
||||||
--
|
|
||||||
|
|
||||||
|
|
||||||
DROP TABLE IF EXISTS `Notes`;
|
|
||||||
|
|
||||||
CREATE TABLE `Notes` (
|
|
||||||
`id` INT NOT NULL AUTO_INCREMENT ,
|
|
||||||
`author` VARCHAR(64) NULL ,
|
|
||||||
`note` VARCHAR(512) NULL ,
|
|
||||||
`datetime` TIMESTAMP NULL DEFAULT NOW() ,
|
|
||||||
`type` INT NULL ,
|
|
||||||
`associated_stroke` INT NULL ,
|
|
||||||
`deleted` INT NULL DEFAULT 0 ,
|
|
||||||
PRIMARY KEY (`id`) );
|
|
||||||
|
|
||||||
|
|
||||||
-- Dump completed on 2015-02-25 20:36:45
|
|
||||||
DROP TABLE IF EXISTS `note_types`;
|
|
||||||
|
|
||||||
CREATE TABLE `WellData`.`note_types` (
|
|
||||||
`id` INT NOT NULL AUTO_INCREMENT ,
|
|
||||||
`type` VARCHAR(64) NULL ,
|
|
||||||
`deleted` INT NULL DEFAULT 0 ,
|
|
||||||
PRIMARY KEY (`id`) );
|
|
||||||
|
|
||||||
|
|
||||||
INSERT INTO `WellData`.`note_types` (`id`, `type`) VALUES ('1', 'Downtime Explanation');
|
|
||||||
INSERT INTO `WellData`.`note_types` (`id`, `type`) VALUES ('2', 'Configuration Change');
|
|
||||||
INSERT INTO `WellData`.`note_types` (`id`, `type`) VALUES ('3', 'Info');
|
|
||||||
INSERT INTO `WellData`.`note_types` (`id`, `type`) VALUES ('4', 'Other');
|
|
||||||
|
|
||||||
DROP TABLE IF EXISTS `fluid_shot`;
|
|
||||||
|
|
||||||
CREATE TABLE `WellData`.`fluid_shot` (
|
|
||||||
`id` INT NOT NULL AUTO_INCREMENT,
|
|
||||||
`shot_datetime` DATETIME NULL,
|
|
||||||
`pump_intake_pressure` FLOAT NULL,
|
|
||||||
`fluid_gradient` FLOAT NULL,
|
|
||||||
`friction` FLOAT NULL,
|
|
||||||
PRIMARY KEY (`id`));
|
|
||||||
|
|
||||||
|
|
||||||
CREATE TABLE `card_history` (
|
|
||||||
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
|
||||||
`Stroke_Time` datetime DEFAULT NULL,
|
|
||||||
`Card_ID` int(11) NOT NULL,
|
|
||||||
`Num_Tapers` int(11) DEFAULT NULL,
|
|
||||||
`Num_Points` int(11) DEFAULT NULL,
|
|
||||||
`Card_Type` varchar(45) DEFAULT NULL,
|
|
||||||
`Tubing_Head_Pressure` float DEFAULT NULL,
|
|
||||||
`Fluid_Gradient` float DEFAULT NULL,
|
|
||||||
`Stuffing_Box_Friction` float DEFAULT NULL,
|
|
||||||
`dt` float DEFAULT NULL,
|
|
||||||
`Downhole_Max_Load` float DEFAULT NULL,
|
|
||||||
`Downhole_Min_Load` float DEFAULT NULL,
|
|
||||||
`Downhole_Max_Position` float DEFAULT NULL,
|
|
||||||
`Downhole_Min_Position` float DEFAULT NULL,
|
|
||||||
`Downhole_Gross_Stroke` float DEFAULT NULL,
|
|
||||||
`Downhole_Adjusted_Gross_Stroke` float DEFAULT NULL,
|
|
||||||
`Downhole_Net_Stroke` float DEFAULT NULL,
|
|
||||||
`Downhole_Fluid_Load` float DEFAULT NULL,
|
|
||||||
`Surface_Max_Load` float DEFAULT NULL,
|
|
||||||
`Surface_Min_Load` float DEFAULT NULL,
|
|
||||||
`Surface_Max_Position` float DEFAULT NULL,
|
|
||||||
`Surface_Min_Position` float DEFAULT NULL,
|
|
||||||
`Tubing_Movement` float DEFAULT NULL,
|
|
||||||
`Surface_Stroke_Length` float DEFAULT NULL,
|
|
||||||
`Fillage_Percent` float DEFAULT NULL,
|
|
||||||
`Polished_Rod_HP` float DEFAULT NULL,
|
|
||||||
`Pump_HP` float DEFAULT NULL,
|
|
||||||
`SPM` float DEFAULT NULL,
|
|
||||||
`Fluid_Level` float DEFAULT NULL,
|
|
||||||
`Pump_Intake_Pressure` float DEFAULT NULL,
|
|
||||||
`Stroke_Production` float DEFAULT NULL,
|
|
||||||
`Drive_Torque_Mode` int(11) DEFAULT NULL,
|
|
||||||
`Drive_Reference` float DEFAULT NULL,
|
|
||||||
`Surface_Position` blob,
|
|
||||||
`Surface_Load` blob,
|
|
||||||
`Downhole_Position` blob,
|
|
||||||
`Downhole_Load` blob,
|
|
||||||
PRIMARY KEY (`id`,`Card_ID`)
|
|
||||||
);
|
|
||||||
|
|
||||||
CREATE TABLE `WellData`.`card_history_dates` (
|
|
||||||
`id` INT NOT NULL AUTO_INCREMENT ,
|
|
||||||
`year` INT NULL ,
|
|
||||||
`month` INT NULL ,
|
|
||||||
`day` INT NULL ,
|
|
||||||
`first_id` INT NULL ,
|
|
||||||
PRIMARY KEY (`id`) );
|
|
||||||
@@ -1,63 +0,0 @@
|
|||||||
import boto3
|
|
||||||
import re
|
|
||||||
import zipfile
|
|
||||||
import os
|
|
||||||
import sys
|
|
||||||
|
|
||||||
#localFilename = "/Users/patrickjmcd/Dropbox (Henry Pump)/Patrick McDonagh/POConsole/POConsole/currentVersion.txt"
|
|
||||||
outputFolder = "/home/poconsole/src"
|
|
||||||
localFilename = "{0}/{1}".format(outputFolder, "currentVersion.txt")
|
|
||||||
|
|
||||||
#s3 = boto3.resource('s3')
|
|
||||||
client = boto3.client('s3')
|
|
||||||
|
|
||||||
def checkUpdateNeeded(force = False):
|
|
||||||
currentVersionObj = client.get_object(Bucket='henrypumpdata', Key='currentVersion.txt')
|
|
||||||
s3currentVersionStr = currentVersionObj['Body']._raw_stream.data
|
|
||||||
s3regex = re.search("(\d+)", s3currentVersionStr)
|
|
||||||
|
|
||||||
s3cvInt = int(s3regex.groups()[0])
|
|
||||||
|
|
||||||
try:
|
|
||||||
localCurrentVersionStr = ""
|
|
||||||
with open(localFilename, 'r') as f:
|
|
||||||
localCurrentVersionStr = f.read()
|
|
||||||
localregex = re.search("(\d+)", localCurrentVersionStr)
|
|
||||||
localcvInt = int(localregex.groups()[0])
|
|
||||||
except:
|
|
||||||
localcvInt = 0
|
|
||||||
|
|
||||||
|
|
||||||
updateNeeded = not ( s3cvInt == localcvInt)
|
|
||||||
|
|
||||||
if updateNeeded or force:
|
|
||||||
try:
|
|
||||||
targetFile = "{0}.zip".format(s3cvInt)
|
|
||||||
# if updateNeeded:
|
|
||||||
# print "Update needed to get {0}".format(targetFile)
|
|
||||||
# if force:
|
|
||||||
# print "Forcing update to get {0}".format(targetFile)
|
|
||||||
downloadCmd = client.download_file('henrypumpdata', targetFile, targetFile)
|
|
||||||
zfile = zipfile.ZipFile(targetFile)
|
|
||||||
zfile.extractall(outputFolder)
|
|
||||||
# for name in zfile.namelist():
|
|
||||||
# (dirname,filename) = os.path.split(name)
|
|
||||||
# if not (dirname[:2] == "__"):
|
|
||||||
# print "Decompressing {0} on {1}.".format(filename,dirname)
|
|
||||||
# if not os.path.exists("{0}/{1}".format(outputFolder, dirname)):
|
|
||||||
# print "Creating {0}/{1}".format(outputFolder, dirname)
|
|
||||||
# os.makedirs("{0}/{1}".format(outputFolder, dirname))
|
|
||||||
# zfile.extract(name, "{0}/{1}".format(outputFolder, dirname))
|
|
||||||
with open(localFilename, 'w+') as f2:
|
|
||||||
f2.write(str(targetFile.replace(".zip","")))
|
|
||||||
return {"status":"success", "message":"Files updated!"}
|
|
||||||
except:
|
|
||||||
return {"status":"error", "message":"error unzipping files"}
|
|
||||||
else:
|
|
||||||
return {"status":"success", "message":"All files are up to date!"}
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
if len(sys.argv) > 1:
|
|
||||||
print checkUpdateNeeded(True)
|
|
||||||
else:
|
|
||||||
print checkUpdateNeeded()
|
|
||||||
3
config
3
config
@@ -1,3 +0,0 @@
|
|||||||
[default]
|
|
||||||
aws_access_key_id = AKIAIJTEFVJEW2236CQQ
|
|
||||||
aws_secret_access_key = 4rrOtq4mIb9g6E5MxXh8LnmlJMtr9GzNlN7sG25Q
|
|
||||||
125
default
125
default
@@ -1,125 +0,0 @@
|
|||||||
# You may add here your
|
|
||||||
# server {
|
|
||||||
# ...
|
|
||||||
# }
|
|
||||||
# statements for each of your virtual hosts to this file
|
|
||||||
|
|
||||||
##
|
|
||||||
# You should look at the following URL's in order to grasp a solid understanding
|
|
||||||
# of Nginx configuration files in order to fully unleash the power of Nginx.
|
|
||||||
# http://wiki.nginx.org/Pitfalls
|
|
||||||
# http://wiki.nginx.org/QuickStart
|
|
||||||
# http://wiki.nginx.org/Configuration
|
|
||||||
#
|
|
||||||
# Generally, you will want to move this file somewhere, and start with a clean
|
|
||||||
# file but keep this around for reference. Or just disable in sites-enabled.
|
|
||||||
#
|
|
||||||
# Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples.
|
|
||||||
##
|
|
||||||
|
|
||||||
server {
|
|
||||||
listen 80 default_server;
|
|
||||||
#listen [::]:80 default_server ipv6only=on;
|
|
||||||
|
|
||||||
root /usr/share/nginx/html;
|
|
||||||
index index.html index.htm;
|
|
||||||
|
|
||||||
# Make site accessible from http://localhost/
|
|
||||||
server_name localhost;
|
|
||||||
|
|
||||||
location ~ ^/(images/|img/|javascript/|js/|css/|stylesheets/|flash/|media/|static/|robots.txt|humans.txt|favicon.ico|navbar.html) {
|
|
||||||
root /home/poconsole/src/www/public;
|
|
||||||
access_log off;
|
|
||||||
expires max;
|
|
||||||
}
|
|
||||||
|
|
||||||
location / {
|
|
||||||
# First attempt to serve request as file, then
|
|
||||||
# as directory, then fall back to displaying a 404.
|
|
||||||
#try_files $uri $uri/ =404;
|
|
||||||
proxy_pass http://127.0.0.1:3000/;
|
|
||||||
# Uncomment to enable naxsi on this location
|
|
||||||
# include /etc/nginx/naxsi.rules
|
|
||||||
}
|
|
||||||
|
|
||||||
location ~ \.(csv) {
|
|
||||||
root /mnt/usb/CSV;
|
|
||||||
autoindex on;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
# Only for nginx-naxsi used with nginx-naxsi-ui : process denied requests
|
|
||||||
#location /RequestDenied {
|
|
||||||
# proxy_pass http://127.0.0.1:8080;
|
|
||||||
#}
|
|
||||||
|
|
||||||
#error_page 404 /404.html;
|
|
||||||
|
|
||||||
# redirect server error pages to the static page /50x.html
|
|
||||||
#
|
|
||||||
#error_page 500 502 503 504 /50x.html;
|
|
||||||
#location = /50x.html {
|
|
||||||
# root /usr/share/nginx/html;
|
|
||||||
#}
|
|
||||||
|
|
||||||
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
|
|
||||||
#
|
|
||||||
#location ~ \.php$ {
|
|
||||||
# fastcgi_split_path_info ^(.+\.php)(/.+)$;
|
|
||||||
# # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
|
|
||||||
#
|
|
||||||
# # With php5-cgi alone:
|
|
||||||
# fastcgi_pass 127.0.0.1:9000;
|
|
||||||
# # With php5-fpm:
|
|
||||||
# fastcgi_pass unix:/var/run/php5-fpm.sock;
|
|
||||||
# fastcgi_index index.php;
|
|
||||||
# include fastcgi_params;
|
|
||||||
#}
|
|
||||||
|
|
||||||
# deny access to .htaccess files, if Apache's document root
|
|
||||||
# concurs with nginx's one
|
|
||||||
#
|
|
||||||
#location ~ /\.ht {
|
|
||||||
# deny all;
|
|
||||||
#}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
# another virtual host using mix of IP-, name-, and port-based configuration
|
|
||||||
#
|
|
||||||
#server {
|
|
||||||
# listen 8000;
|
|
||||||
# listen somename:8080;
|
|
||||||
# server_name somename alias another.alias;
|
|
||||||
# root html;
|
|
||||||
# index index.html index.htm;
|
|
||||||
#
|
|
||||||
# location / {
|
|
||||||
# try_files $uri $uri/ =404;
|
|
||||||
# }
|
|
||||||
#}
|
|
||||||
|
|
||||||
|
|
||||||
# HTTPS server
|
|
||||||
#
|
|
||||||
#server {
|
|
||||||
# listen 443;
|
|
||||||
# server_name localhost;
|
|
||||||
#
|
|
||||||
# root html;
|
|
||||||
# index index.html index.htm;
|
|
||||||
#
|
|
||||||
# ssl on;
|
|
||||||
# ssl_certificate cert.pem;
|
|
||||||
# ssl_certificate_key cert.key;
|
|
||||||
#
|
|
||||||
# ssl_session_timeout 5m;
|
|
||||||
#
|
|
||||||
# ssl_protocols SSLv3 TLSv1 TLSv1.1 TLSv1.2;
|
|
||||||
# ssl_ciphers "HIGH:!aNULL:!MD5 or HIGH:!aNULL:!MD5:!3DES";
|
|
||||||
# ssl_prefer_server_ciphers on;
|
|
||||||
#
|
|
||||||
# location / {
|
|
||||||
# try_files $uri $uri/ =404;
|
|
||||||
# }
|
|
||||||
#}
|
|
||||||
14
interfaces
14
interfaces
@@ -8,13 +8,19 @@ netmask 255.255.255.0
|
|||||||
gateway 192.168.1.150
|
gateway 192.168.1.150
|
||||||
|
|
||||||
auto wlan0
|
auto wlan0
|
||||||
|
|
||||||
#Normal Wifi Mode
|
#Normal Wifi Mode
|
||||||
#allow-hotplug wlan0
|
#allow-hotplug wlan0
|
||||||
#iface wlan0 inet manual
|
#iface wlan0 inet manual
|
||||||
#wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
|
#wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
|
||||||
|
|
||||||
#ACCESS POINT MODE
|
#ACCESS POINT MODE
|
||||||
iface wlan0 inet static
|
#iface wlan0 inet static
|
||||||
address 192.168.4.1
|
#address 192.168.4.1
|
||||||
netmask 255.255.255.0
|
#netmask 255.255.255.0
|
||||||
up iptables-restore < /etc/iptables.ipv4.nat
|
#up iptables-restore < /etc/iptables.ipv4.nat
|
||||||
|
|
||||||
|
#HENRYPUMPNETWORK
|
||||||
|
#iface wlan0 inet dhcp
|
||||||
|
# wpa-ssid "Henry Pump"
|
||||||
|
# wpa-psk "HenryHP@1903"
|
||||||
|
|||||||
5
loggers
5
loggers
@@ -17,20 +17,17 @@
|
|||||||
case "$1" in
|
case "$1" in
|
||||||
start)
|
start)
|
||||||
echo "Starting loggers"
|
echo "Starting loggers"
|
||||||
kill -9 $(cat /root/alarmLogger.pid)
|
|
||||||
kill -9 $(cat /root/dataLogger.pid)
|
kill -9 $(cat /root/dataLogger.pid)
|
||||||
# run application you want to start
|
# run application you want to start
|
||||||
#python /home/poconsole/src/dataLogger/alarmLogger.py &
|
#python /home/poconsole/src/dataLogger/alarmLogger.py &
|
||||||
#python /home/poconsole/src/dataLogger/dataLogger.py &
|
#python /home/poconsole/src/dataLogger/dataLogger.py &
|
||||||
/usr/bin/python /root/src/dataLogger/alarmLogger.py > /dev/null 2>&1 & echo $! > "/root/alarmLogger.pid"
|
/usr/bin/python /root/poconsole/datalogger/dataLogger.py > /dev/null 2>&1 & echo $! > "/root/dataLogger.pid"
|
||||||
/usr/bin/python /root/src/dataLogger/dataLogger.py > /dev/null 2>&1 & echo $! > "/root/dataLogger.pid"
|
|
||||||
|
|
||||||
;;
|
;;
|
||||||
stop)
|
stop)
|
||||||
echo "Stopping loggers"
|
echo "Stopping loggers"
|
||||||
# kill application you want to stop
|
# kill application you want to stop
|
||||||
#killall python
|
#killall python
|
||||||
kill -9 $(cat /root/alarmLogger.pid)
|
|
||||||
kill -9 $(cat /root/dataLogger.pid)
|
kill -9 $(cat /root/dataLogger.pid)
|
||||||
|
|
||||||
;;
|
;;
|
||||||
|
|||||||
124
my.cnf
124
my.cnf
@@ -1,124 +0,0 @@
|
|||||||
# The MySQL database server configuration file.
|
|
||||||
#
|
|
||||||
# You can copy this to one of:
|
|
||||||
# - "/etc/mysql/my.cnf" to set global options,
|
|
||||||
# - "~/.my.cnf" to set user-specific options.
|
|
||||||
#
|
|
||||||
# One can use all long options that the program supports.
|
|
||||||
# Run program with --help to get a list of available options and with
|
|
||||||
# --print-defaults to see which it would actually understand and use.
|
|
||||||
#
|
|
||||||
# For explanations see
|
|
||||||
# http://dev.mysql.com/doc/mysql/en/server-system-variables.html
|
|
||||||
|
|
||||||
# This will be passed to all mysql clients
|
|
||||||
# It has been reported that passwords should be enclosed with ticks/quotes
|
|
||||||
# escpecially if they contain "#" chars...
|
|
||||||
# Remember to edit /etc/mysql/debian.cnf when changing the socket location.
|
|
||||||
[client]
|
|
||||||
port = 3306
|
|
||||||
socket = /var/run/mysqld/mysqld.sock
|
|
||||||
|
|
||||||
# Here is entries for some specific programs
|
|
||||||
# The following values assume you have at least 32M ram
|
|
||||||
|
|
||||||
# This was formally known as [safe_mysqld]. Both versions are currently parsed.
|
|
||||||
[mysqld_safe]
|
|
||||||
socket = /var/run/mysqld/mysqld.sock
|
|
||||||
nice = 0
|
|
||||||
|
|
||||||
[mysqld]
|
|
||||||
#
|
|
||||||
# * Basic Settings
|
|
||||||
#
|
|
||||||
user = mysql
|
|
||||||
pid-file = /var/run/mysqld/mysqld.pid
|
|
||||||
socket = /var/run/mysqld/mysqld.sock
|
|
||||||
port = 3306
|
|
||||||
basedir = /usr
|
|
||||||
datadir = /var/lib/mysql
|
|
||||||
tmpdir = /tmp
|
|
||||||
lc-messages-dir = /usr/share/mysql
|
|
||||||
skip-external-locking
|
|
||||||
#
|
|
||||||
# Instead of skip-networking the default is now to listen only on
|
|
||||||
# localhost which is more compatible and is not less secure.
|
|
||||||
bind-address = 127.0.0.1
|
|
||||||
#
|
|
||||||
# * Fine Tuning
|
|
||||||
#
|
|
||||||
key_buffer = 16M
|
|
||||||
max_allowed_packet = 16M
|
|
||||||
thread_stack = 192K
|
|
||||||
thread_cache_size = 8
|
|
||||||
# This replaces the startup script and checks MyISAM tables if needed
|
|
||||||
# the first time they are touched
|
|
||||||
myisam-recover = BACKUP
|
|
||||||
#max_connections = 100
|
|
||||||
#table_cache = 64
|
|
||||||
#thread_concurrency = 10
|
|
||||||
#
|
|
||||||
# * Query Cache Configuration
|
|
||||||
#
|
|
||||||
query_cache_limit = 1M
|
|
||||||
query_cache_size = 16M
|
|
||||||
#
|
|
||||||
# * Logging and Replication
|
|
||||||
#
|
|
||||||
# Both location gets rotated by the cronjob.
|
|
||||||
# Be aware that this log type is a performance killer.
|
|
||||||
# As of 5.1 you can enable the log at runtime!
|
|
||||||
#general_log_file = /var/log/mysql/mysql.log
|
|
||||||
#general_log = 1
|
|
||||||
#
|
|
||||||
# Error logging goes to syslog due to /etc/mysql/conf.d/mysqld_safe_syslog.cnf.
|
|
||||||
#
|
|
||||||
# Here you can see queries with especially long duration
|
|
||||||
#log_slow_queries = /var/log/mysql/mysql-slow.log
|
|
||||||
#long_query_time = 2
|
|
||||||
#log-queries-not-using-indexes
|
|
||||||
#
|
|
||||||
# The following can be used as easy to replay backup logs or for replication.
|
|
||||||
# note: if you are setting up a replication slave, see README.Debian about
|
|
||||||
# other settings you may need to change.
|
|
||||||
#server-id = 1
|
|
||||||
#log_bin = /var/log/mysql/mysql-bin.log
|
|
||||||
expire_logs_days = 10
|
|
||||||
max_binlog_size = 100M
|
|
||||||
#binlog_do_db = include_database_name
|
|
||||||
#binlog_ignore_db = include_database_name
|
|
||||||
#
|
|
||||||
# * InnoDB
|
|
||||||
#
|
|
||||||
# InnoDB is enabled by default with a 10MB datafile in /var/lib/mysql/.
|
|
||||||
# Read the manual for more InnoDB related options. There are many!
|
|
||||||
#
|
|
||||||
# * Security Features
|
|
||||||
#
|
|
||||||
# Read the manual, too, if you want chroot!
|
|
||||||
# chroot = /var/lib/mysql/
|
|
||||||
#
|
|
||||||
# For generating SSL certificates I recommend the OpenSSL GUI "tinyca".
|
|
||||||
#
|
|
||||||
# ssl-ca=/etc/mysql/cacert.pem
|
|
||||||
# ssl-cert=/etc/mysql/server-cert.pem
|
|
||||||
# ssl-key=/etc/mysql/server-key.pem
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[mysqldump]
|
|
||||||
quick
|
|
||||||
quote-names
|
|
||||||
max_allowed_packet = 16M
|
|
||||||
|
|
||||||
[mysql]
|
|
||||||
#no-auto-rehash # faster start of mysql but no tab completition
|
|
||||||
|
|
||||||
[isamchk]
|
|
||||||
key_buffer = 16M
|
|
||||||
|
|
||||||
#
|
|
||||||
# * IMPORTANT: Additional settings that can override those from this file!
|
|
||||||
# The files must end with '.cnf', otherwise they'll be ignored.
|
|
||||||
#
|
|
||||||
!includedir /etc/mysql/conf.d/
|
|
||||||
71
setup.sh
71
setup.sh
@@ -20,12 +20,10 @@ sudo mv hostname /etc/hostname
|
|||||||
echo "Setting up networking"
|
echo "Setting up networking"
|
||||||
sudo mv interfaces /etc/network/interfaces
|
sudo mv interfaces /etc/network/interfaces
|
||||||
sudo apt-get update
|
sudo apt-get update
|
||||||
sudo apt-get -y upgrade
|
sudo apt-get -y install python-dev htop screen sqlite3
|
||||||
sudo apt-get -y install unzip cmake python-dev htop nginx avahi-daemon screen g++ gcc curl sqlite3
|
|
||||||
|
|
||||||
echo "Setting up USB Drive"
|
echo "Setting up USB Drive"
|
||||||
sudo mkdir /mnt/usb
|
sudo mkdir /mnt/usb
|
||||||
sudo mkdir /mnt/usb/CSV
|
|
||||||
echo "Formatting to EXT4"
|
echo "Formatting to EXT4"
|
||||||
sudo mkfs.ext4 /dev/sda1 -L usbdrive
|
sudo mkfs.ext4 /dev/sda1 -L usbdrive
|
||||||
echo "Adding entry for USB in /etc/fstab"
|
echo "Adding entry for USB in /etc/fstab"
|
||||||
@@ -36,47 +34,43 @@ sudo chmod 777 /mnt/usb
|
|||||||
sudo chmod 777 /mnt/usb/*
|
sudo chmod 777 /mnt/usb/*
|
||||||
|
|
||||||
|
|
||||||
# echo "Configuring MySQL to use the USB drive"
|
echo "Configuring MySQL to use the USB drive"
|
||||||
# sudo apt-get install mysql-server mysql-client libmysqlclient-dev
|
sudo apt-get install mariadb-server mariadb-client
|
||||||
# cd /mnt/usb
|
cd /mnt/usb
|
||||||
# sudo mkdir mysql
|
sudo mkdir mysql
|
||||||
# sudo su
|
sudo cp -Rv /var/lib/mysql/* /mnt/usb/mysql/
|
||||||
# cp -Rv /var/lib/mysql/* /mnt/usb/mysql/
|
sudo chown -R mysql:mysql /mnt/usb/mysql
|
||||||
# chown -R mysql:mysql /mnt/usb/mysql
|
cd $installLoc/setup
|
||||||
# exit
|
sudo service mysql stop
|
||||||
# cd $installLoc/setup
|
sudo sed 's:/var/lib/mysql:/mnt/usb/mysql:g' /etc/mysql/my.cnf
|
||||||
# sudo service mysql stop
|
sudo service mysql restart
|
||||||
# sudo sed 's:/var/lib/mysql:/mnt/usb/mysql:g' /etc/mysql/my.cnf
|
|
||||||
# sudo service mysql restart
|
|
||||||
|
|
||||||
|
|
||||||
# echo "Configuring MySQL"
|
echo "Configuring MySQL"
|
||||||
# sudo mv my.cnf /etc/mysql/my.cnf
|
sudo service mysql restart
|
||||||
# sudo service mysql restart
|
mysql --user="root" --password="henrypump" --execute="source WellDataEmpty.sql"
|
||||||
# mysql --user="root" --password="henrypump" --execute="source WellDataEmpty.sql"
|
mysql --user="root" --password="henrypump" --execute="source setupUsers.sql"
|
||||||
# mysql --user="root" --password="henrypump" --execute="source setupUsers.sql"
|
|
||||||
|
|
||||||
|
|
||||||
echo "installing TuxEip"
|
# echo "installing TuxEip"
|
||||||
wget https://github.com/leicht/TuxPLC/archive/master.zip
|
# wget https://github.com/leicht/TuxPLC/archive/master.zip
|
||||||
unzip master.zip
|
# unzip master.zip
|
||||||
cd TuxPLC-master/tuxeip
|
# cd TuxPLC-master/tuxeip
|
||||||
cmake CMakeLists.txt
|
# cmake CMakeLists.txt
|
||||||
make
|
# make
|
||||||
|
#
|
||||||
|
# cd lib
|
||||||
|
# ar -x libtuxeip.a
|
||||||
|
# gcc -shared *.o -o libtuxeip.so
|
||||||
|
# sudo cp libtuxeip.so /usr/lib/
|
||||||
|
|
||||||
cd lib
|
|
||||||
ar -x libtuxeip.a
|
|
||||||
gcc -shared *.o -o libtuxeip.so
|
|
||||||
sudo cp libtuxeip.so /usr/lib/
|
|
||||||
|
|
||||||
cd $installLoc/setup
|
cd $installLoc/setup
|
||||||
#sudo wget -O /etc/apt/sources.list.d/repository.pi3g.com.list http://repository.pi3g.com/sources.list
|
#sudo wget -O /etc/apt/sources.list.d/repository.pi3g.com.list http://repository.pi3g.com/sources.list
|
||||||
#wget -O - http://repository.pi3g.com/pubkey | sudo apt-key add -
|
#wget -O - http://repository.pi3g.com/pubkey | sudo apt-key add -
|
||||||
|
|
||||||
|
# echo "Configuring nginx"
|
||||||
|
# sudo mv default /etc/nginx/sites-enabled/default
|
||||||
echo "Configuring nginx"
|
|
||||||
sudo mv default /etc/nginx/sites-enabled/default
|
|
||||||
|
|
||||||
echo "installing node"
|
echo "installing node"
|
||||||
wget http://node-arm.herokuapp.com/node_latest_armhf.deb
|
wget http://node-arm.herokuapp.com/node_latest_armhf.deb
|
||||||
@@ -104,14 +98,7 @@ wget https://bootstrap.pypa.io/get-pip.py
|
|||||||
sudo python get-pip.py
|
sudo python get-pip.py
|
||||||
sudo pip install mysql requests pycomm
|
sudo pip install mysql requests pycomm
|
||||||
|
|
||||||
echo "Setting up POConsole software"
|
cd $installLoc/../www
|
||||||
mkdir $installLoc/src
|
|
||||||
cd $installLoc/src
|
|
||||||
git clone http://patrickjmcd@bitbucket.poconsole.net/scm/poconsole/datalogger.git
|
|
||||||
git clone http://patrickjmcd@bitbucket.poconsole.net/scm/poconsole/www.git
|
|
||||||
git clone http://patrickjmcd@bitbucket.poconsole.net/scm/poconsole/filemanager.git
|
|
||||||
|
|
||||||
cd $installLoc/src/www
|
|
||||||
bower install
|
bower install
|
||||||
npm install
|
npm install
|
||||||
|
|
||||||
|
|||||||
34
usbMount
34
usbMount
@@ -1,34 +0,0 @@
|
|||||||
#! /bin/sh
|
|
||||||
# /etc/init.d/usbMount
|
|
||||||
|
|
||||||
### BEGIN INIT INFO
|
|
||||||
# Provides: usbMount
|
|
||||||
# Required-Start: $remote_fs $syslog
|
|
||||||
# Required-Stop: $remote_fs $syslog
|
|
||||||
# Default-Start: 2 3 4 5
|
|
||||||
# Default-Stop: 0 1 6
|
|
||||||
# Short-Description: Simple script to start a program at boot
|
|
||||||
# Description: A simple script from www.stuffaboutcode.com which will start / stop a program a boot / shutdown.
|
|
||||||
### END INIT INFO
|
|
||||||
|
|
||||||
# If you want a command to always run, put it here
|
|
||||||
|
|
||||||
# Carry out specific functions when asked to by the system
|
|
||||||
case "$1" in
|
|
||||||
start)
|
|
||||||
echo "mounting USB /dev/sda1 to /usb/mnt"
|
|
||||||
# run application you want to start
|
|
||||||
sudo mount -o uid=poconsole,gid=poconsole /dev/sda1 /mnt/usb
|
|
||||||
;;
|
|
||||||
stop)
|
|
||||||
echo "unmounting /usb/mnt"
|
|
||||||
# kill application you want to stop
|
|
||||||
sudo umount /mnt/usb
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
echo "Usage: /etc/init.d/usbMount {start|stop}"
|
|
||||||
exit 1
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
exit 0
|
|
||||||
Reference in New Issue
Block a user