aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonathan McCrohan <jmccrohan@gmail.com>2012-03-13 00:59:48 +0000
committerJonathan McCrohan <jmccrohan@gmail.com>2012-03-13 00:59:48 +0000
commitef40490b47e4ffa64ffae41b43ee5096d1460ece (patch)
tree0ccb3853d28be9e96ea8b2207de489cdcff51f06
parent267d9a07255d96a564da64ce5c819ebc4701d5f1 (diff)
downloadverteco-ef40490b47e4ffa64ffae41b43ee5096d1460ece.tar.gz
ftpupload: use fully qualified paths
cron requires them
-rwxr-xr-xsrc/ftpupload13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/ftpupload b/src/ftpupload
index 09dfe4d..01cbdb2 100755
--- a/src/ftpupload
+++ b/src/ftpupload
@@ -20,15 +20,18 @@ FIVEDAYLOG=`/usr/bin/ftphelper --mac`"_"`date +%Y_%m_%d --date='4 days ago'`"_00
SIXDAYLOG=`/usr/bin/ftphelper --mac`"_"`date +%Y_%m_%d --date='5 days ago'`"_00_00_00.log"
SEVENDAYLOG=`/usr/bin/ftphelper --mac`"_"`date +%Y_%m_%d --date='6 days ago'`"_00_00_00.log"
+# enter modbuslog directory
+cd /var/modbuslog/
+
# move file to archive
-mv $CURRENTLOG /var/modbuslog/archive/
+/bin/mv $CURRENTLOG /var/modbuslog/archive/
# mput is dumb, and if we don't cd to the directory,
# it will try to save file to /var/modbuslog/MAC.....log on ftp remote
cd /var/modbuslog/archive/
# login to remote server and upload
-ftp -n -v -i $SERVER <<EOF
+/usr/bin/ftp -n -v -i $SERVER <<EOF
user $USERNAME $PASSWORD
cd $REMOTEDIRECTORY
mput $CURRENTLOG
@@ -41,6 +44,10 @@ mput $SEVENDAYLOG
bye
EOF
+EXITSTATUS=$?
+
# remove files after 3 months
CLEANUP="/var/modbus/archive/"`/usr/bin/ftphelper --mac`"_"`date +%Y_%m --date='4 months ago'`"*.log"
-rm $CLEANUP
+/bin/rm $CLEANUP
+
+exit $EXITSTATUS
/span>/+10 2012-03-05Fix copypasta errorv1.1Jonathan McCrohan1-10/+18 2012-03-05Rearrange syslog output to read 8N1 rather than N81Jonathan McCrohan1-2/+2 2012-03-05Refactor codeJonathan McCrohan2-6/+4 2012-03-05Add syslog loggingJonathan McCrohan1-24/+57 2012-03-04Remove unused #define statementsJonathan McCrohan1-3/+0 2012-02-20Prune archive after 3 monthsJonathan McCrohan3-0/+7 2012-02-20Update documentationJonathan McCrohan1-3/+5 2012-02-20Add PHP to make installJonathan McCrohan1-0/+3 2012-02-20Update MakefileJonathan McCrohan1-0/+17 2012-02-20Move interval.txt to src/Jonathan McCrohan2-1/+1 2012-02-19Remove debug/testing files.Jonathan McCrohan50-4742/+0 2012-02-15Archive files after upload.Jonathan McCrohan1-0/+2 2012-02-12Fix typo in README.Jonathan McCrohan1-1/+1 2012-02-12Add ftp upload function + add documentation.Jonathan McCrohan5-3/+151 2012-01-10Handle 32bit signed overflow.Jonathan McCrohan1-1/+6 2012-01-10Update README.Jonathan McCrohan1-1/+3