aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJonathan McCrohan <jmccrohan@gmail.com>2012-12-04 01:12:15 +0000
committerJonathan McCrohan <jmccrohan@gmail.com>2012-12-04 01:29:32 +0000
commit45b134f897572318f182aa5faa348c5bd39fa7ae (patch)
tree1dec0092e27d994750b39b809e88182515e4e705 /src
parent9083b82a25bdb9c25e7da0cfb4ebe515186c71e1 (diff)
downloadverteco-45b134f897572318f182aa5faa348c5bd39fa7ae.tar.gz
ftpupload: decouple ftpupload from modbuslog
Allow ftpupload to be used as an independent program. This enables it to be used by both modbuslog and phidgetcontrol. The ftp stanza in /etc/modbuslog has been split out into a separate ftpupload configuration file located at /etc/ftpupload. ftpupload now reads the $UPLOADTYPE variable to determine which type of upload to execute. If $UPLOADTYPE has not been set, ftpupload will default to modbuslog.
Diffstat (limited to '')
-rw-r--r--src/ftphelper.c2
-rwxr-xr-xsrc/ftpupload3
-rw-r--r--src/modbuslog.cfg7
-rw-r--r--src/modbuslog_all.cfg7
-rw-r--r--src/modbuslog_pulse.cfg7
-rw-r--r--src/modbuslog_ws.cfg7
-rw-r--r--src/modbuslog_wsgps.cfg7
7 files changed, 3 insertions, 37 deletions
diff --git a/src/ftphelper.c b/src/ftphelper.c
index 69527db..889b9c5 100644
--- a/src/ftphelper.c
+++ b/src/ftphelper.c
@@ -64,7 +64,7 @@ int main(int argc, char *argv[]) {
return 0;
}
- const char *configfile = "/etc/modbuslog.cfg";
+ const char *configfile = "/etc/ftpupload.cfg";
config_t cfg;
const char *ftp_server;
const char *ftp_username;
diff --git a/src/ftpupload b/src/ftpupload
index 7c612d5..f02e269 100755
--- a/src/ftpupload
+++ b/src/ftpupload
@@ -7,7 +7,8 @@
USERNAME=`/usr/bin/ftphelper --username`
PASSWORD=`/usr/bin/ftphelper --password`
SERVER=`/usr/bin/ftphelper --server`
-LOCALDIRECTORY="/var/modbuslog"
+# default to modbuslog if unset
+LOCALDIRECTORY="/var/${UPLOADTYPE-modbuslog}"
REMOTEDIRECTORY=`/usr/bin/ftphelper --directory`
# current file to be uploaded
diff --git a/src/modbuslog.cfg b/src/modbuslog.cfg
index 9c23660..75f29eb 100644
--- a/src/modbuslog.cfg
+++ b/src/modbuslog.cfg
@@ -11,13 +11,6 @@ modbus = {
retry = 2;
};
-ftp = {
- server = "ftp.verteco.ie";
- username = "loggerdevice";
- password = "securepassword";
- directory = ".";
-};
-
reading= (
{
# digirail series number
diff --git a/src/modbuslog_all.cfg b/src/modbuslog_all.cfg
index 9c23660..75f29eb 100644
--- a/src/modbuslog_all.cfg
+++ b/src/modbuslog_all.cfg
@@ -11,13 +11,6 @@ modbus = {
retry = 2;
};
-ftp = {
- server = "ftp.verteco.ie";
- username = "loggerdevice";
- password = "securepassword";
- directory = ".";
-};
-
reading= (
{
# digirail series number
diff --git a/src/modbuslog_pulse.cfg b/src/modbuslog_pulse.cfg
index 05377a9..e628bc2 100644
--- a/src/modbuslog_pulse.cfg
+++ b/src/modbuslog_pulse.cfg
@@ -11,13 +11,6 @@ modbus = {
retry = 2;
};
-ftp = {
- server = "ftp.verteco.ie";
- username = "loggerdevice";
- password = "securepassword";
- directory = ".";
-};
-
reading= (
{
# digirail series number
diff --git a/src/modbuslog_ws.cfg b/src/modbuslog_ws.cfg
index 9d0d8e6..97b033e 100644
--- a/src/modbuslog_ws.cfg
+++ b/src/modbuslog_ws.cfg
@@ -11,13 +11,6 @@ modbus = {
retry = 2;
};
-ftp = {
- server = "ftp.verteco.ie";
- username = "loggerdevice";
- password = "securepassword";
- directory = ".";
-};
-
reading= (
{
# digirail series number
diff --git a/src/modbuslog_wsgps.cfg b/src/modbuslog_wsgps.cfg
index 0dbf5a4..2022da4 100644
--- a/src/modbuslog_wsgps.cfg
+++ b/src/modbuslog_wsgps.cfg
@@ -11,13 +11,6 @@ modbus = {
retry = 2;
};
-ftp = {
- server = "ftp.verteco.ie";
- username = "loggerdevice";
- password = "securepassword";
- directory = ".";
-};
-
reading= (
{