aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rwxr-xr-xsrc/ftpupload9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/ftpupload b/src/ftpupload
index 01cbdb2..7c612d5 100755
--- a/src/ftpupload
+++ b/src/ftpupload
@@ -7,6 +7,7 @@
USERNAME=`/usr/bin/ftphelper --username`
PASSWORD=`/usr/bin/ftphelper --password`
SERVER=`/usr/bin/ftphelper --server`
+LOCALDIRECTORY="/var/modbuslog"
REMOTEDIRECTORY=`/usr/bin/ftphelper --directory`
# current file to be uploaded
@@ -21,14 +22,14 @@ SIXDAYLOG=`/usr/bin/ftphelper --mac`"_"`date +%Y_%m_%d --date='5 days ago'`"_00_
SEVENDAYLOG=`/usr/bin/ftphelper --mac`"_"`date +%Y_%m_%d --date='6 days ago'`"_00_00_00.log"
# enter modbuslog directory
-cd /var/modbuslog/
+cd $LOCALDIRECTORY
# move file to archive
-/bin/mv $CURRENTLOG /var/modbuslog/archive/
+/bin/mv $CURRENTLOG $LOCALDIRECTORY/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/
+cd $LOCALDIRECTORY/archive/
# login to remote server and upload
/usr/bin/ftp -n -v -i $SERVER <<EOF
@@ -47,7 +48,7 @@ EOF
EXITSTATUS=$?
# remove files after 3 months
-CLEANUP="/var/modbus/archive/"`/usr/bin/ftphelper --mac`"_"`date +%Y_%m --date='4 months ago'`"*.log"
+CLEANUP="$LOCALDIRECTORY/archive/"`/usr/bin/ftphelper --mac`"_"`date +%Y_%m --date='4 months ago'`"*.log"
/bin/rm $CLEANUP
exit $EXITSTATUS