diff options
Diffstat (limited to '')
-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 |