diff options
author | Jonathan McCrohan <jmccrohan@gmail.com> | 2012-03-13 00:59:48 +0000 |
---|---|---|
committer | Jonathan McCrohan <jmccrohan@gmail.com> | 2012-03-13 00:59:48 +0000 |
commit | ef40490b47e4ffa64ffae41b43ee5096d1460ece (patch) | |
tree | 0ccb3853d28be9e96ea8b2207de489cdcff51f06 /src/ftpupload | |
parent | 267d9a07255d96a564da64ce5c819ebc4701d5f1 (diff) | |
download | verteco-ef40490b47e4ffa64ffae41b43ee5096d1460ece.tar.gz |
ftpupload: use fully qualified paths
cron requires them
Diffstat (limited to 'src/ftpupload')
-rwxr-xr-x | src/ftpupload | 13 |
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 |