aboutsummaryrefslogtreecommitdiffstats
path: root/script/load-mail-server-logs
diff options
context:
space:
mode:
authorMatthew Landauer <matthew@openaustralia.org>2012-10-11 10:17:18 +1100
committerMatthew Landauer <matthew@openaustralia.org>2012-10-11 10:17:18 +1100
commitadfdae95577933b0cf0ed88483b78c1f7cccda44 (patch)
tree5deff554abfe16216cced6f6ae8c913ca5b8318d /script/load-mail-server-logs
parente5dd06bb90b28b14b9a476d999d22ca345dabf07 (diff)
Rename script/load-exim-logs to script/load-mail-server-logs
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..234aecd3b
--- /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 -rt $OPTION_MTA_LOG_PATH 2>/dev/null | tail -3 )
+for X in $LATEST
+do
+ bundle exec ./runner 'MailServerLog.load_file("'$X'")'
+done