aboutsummaryrefslogtreecommitdiffstats
path: root/src/ftpupload
diff options
context:
space:
mode:
authorJonathan McCrohan <jmccrohan@gmail.com>2012-02-12 23:25:19 +0000
committerJonathan McCrohan <jmccrohan@gmail.com>2012-02-12 23:25:19 +0000
commitd9e7690dc169c82d0011ca0a49f74e980f707b0b (patch)
tree3c3a9ffeb773a94e838d2c7f9d9e6e76374809cc /src/ftpupload
parent94dc9792a9f636771ea1388f395ca89a2d07c74b (diff)
downloadverteco-d9e7690dc169c82d0011ca0a49f74e980f707b0b.tar.gz
Add ftp upload function + add documentation.
Diffstat (limited to '')
-rwxr-xr-xsrc/ftpupload21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/ftpupload b/src/ftpupload
new file mode 100755
index 0000000..a5f565b
--- /dev/null
+++ b/src/ftpupload
@@ -0,0 +1,21 @@
+#!/bin/sh
+
+# ftpupload
+#
+# Copyright (C) 2012 Jonathan McCrohan
+
+USERNAME=`/usr/bin/ftphelper --username`
+PASSWORD=`/usr/bin/ftphelper --password`
+SERVER=`/usr/bin/ftphelper --server`
+REMOTEDIRECTORY=`/usr/bin/ftphelper --directory`
+
+# local file to be uploaded
+FILE="/var/modbuslog/"`/usr/bin/ftphelper --mac`"_"`date +%Y_%m_%d --date='1 days ago'`"_00_00_00.log"
+
+# login to remote server and upload
+ftp -n -i $SERVER <<EOF
+user $USERNAME $PASSWORD
+cd $REMOTEDIRECTORY
+mput $FILE
+bye
+EOF