diff options
author | Jonathan McCrohan <jmccrohan@gmail.com> | 2012-11-27 14:25:13 +0000 |
---|---|---|
committer | Jonathan McCrohan <jmccrohan@gmail.com> | 2012-11-27 14:25:13 +0000 |
commit | 3af2ad7472d267789688cedcc193fd925e3256e2 (patch) | |
tree | b2cbbc0ea202cf22344a6b656d6c01d7500d20fc | |
parent | 01ef8649a9b7810e84941b0aea253e04ef0a987a (diff) | |
download | verteco-3af2ad7472d267789688cedcc193fd925e3256e2.tar.gz |
ftphelper: parameterise LOCALDIRECTORY
-rwxr-xr-x | src/ftpupload | 9 |
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 |