aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonathan McCrohan <jmccrohan@gmail.com>2012-02-20 11:25:26 +0000
committerJonathan McCrohan <jmccrohan@gmail.com>2012-02-20 11:43:34 +0000
commita6a6f9c5a4ddc0295bb12fd93ed0ba23ed696122 (patch)
tree83a6d5526dc5998fa02a6958a6d18367e8fd9e0a
parenta5b894ac9c583066da6fbd144b85d24f0ed58568 (diff)
downloadverteco-a6a6f9c5a4ddc0295bb12fd93ed0ba23ed696122.tar.gz
Prune archive after 3 months
-rw-r--r--Makefile1
-rw-r--r--README1
-rwxr-xr-xsrc/ftpupload5
3 files changed, 7 insertions, 0 deletions
diff --git a/Makefile b/Makefile
index a619764..7659c27 100644
--- a/Makefile
+++ b/Makefile
@@ -27,6 +27,7 @@ install: all
then \
mkdir $(MODBUSLOGLOGDIR); \
mkdir $(MODBUSLOGLOGDIR)/interval; \
+ mkdir $(MODBUSLOGLOGDIR)/archive; \
fi
test -f $(MODBUSLOGLOGDIR)/interval/interval.txt || $(INSTALL) -m 644 $(SDIR)/interval.txt $(MODBUSLOGLOGDIR)/interval/interval.txt
$(INSTALL) $(SDIR)/ftpupload $(FTPHELPERDIR)/ftpupload
diff --git a/README b/README
index e8618e2..151a255 100644
--- a/README
+++ b/README
@@ -44,6 +44,7 @@ Required files:
/etc/modbuslog.cfg configuration file
/var/modbuslog/ output directory where logs are stored
/var/modbuslog/interval/interval.txt textfile storing unique interval
+/var/modbuslog/archive/ directory containing archived log files
/var/www/ webserver directory for php scripts
Configuration:
diff --git a/src/ftpupload b/src/ftpupload
index 2483764..7d46f46 100755
--- a/src/ftpupload
+++ b/src/ftpupload
@@ -20,4 +20,9 @@ mput $FILE
bye
EOF
+# move file to archive
mv $FILE /var/modbuslog/archive/
+
+# remove files after 3 months
+CLEANUP="/var/modbus/archive/"`/usr/bin/ftphelper --mac`"_"`date +%Y_%m --date='4 months ago'`"*.log"
+rm $CLEANUP