aboutsummaryrefslogtreecommitdiffstats
path: root/script/load-mail-server-logs
diff options
context:
space:
mode:
Diffstat (limited to 'script/load-mail-server-logs')
-rwxr-xr-xscript/load-mail-server-logs27
1 files changed, 27 insertions, 0 deletions
diff --git a/script/load-mail-server-logs b/script/load-mail-server-logs
new file mode 100755
index 000000000..9ff7a1401
--- /dev/null
+++ b/script/load-mail-server-logs
@@ -0,0 +1,27 @@
+#!/bin/bash
+
+LOC=`dirname "$0"`
+
+cd "$LOC"/..
+source commonlib/shlib/deployfns
+read_conf config/general
+
+# Specific file if specified
+if [ x$1 != x ]
+then
+ case "$1" in
+ /*) f=$1 ;;
+ *) f=$(pwd)/$1 ;;
+ esac
+ cd "$LOC"
+ bundle exec ./runner 'MailServerLog.load_file("'$f'")'
+ exit
+fi
+
+# Load in last three days worth of logs (if they've been modified)
+cd "$LOC"
+LATEST=$( ls $OPTION_MTA_LOG_PATH 2>/dev/null | sort | tail -3 )
+for X in $LATEST
+do
+ bundle exec ./runner 'MailServerLog.load_file("'$X'")'
+done