summaryrefslogtreecommitdiff
path: root/localshowkannelsms
diff options
context:
space:
mode:
authorroot <root@jones.dk>2010-05-04 12:03:48 +0200
committerroot <root@jones.dk>2010-05-04 12:03:48 +0200
commitb33708b7bad20a5ced676f80f16188bb523613a6 (patch)
tree89d129547c733d4c485372451b0b1c1f35bbf353 /localshowkannelsms
parent154d5bd7eb031369256a24a29684e87df98a2e24 (diff)
Add/update sms- and Kannel-related scripts.
Diffstat (limited to 'localshowkannelsms')
-rwxr-xr-xlocalshowkannelsms22
1 files changed, 22 insertions, 0 deletions
diff --git a/localshowkannelsms b/localshowkannelsms
new file mode 100755
index 0000000..437b72b
--- /dev/null
+++ b/localshowkannelsms
@@ -0,0 +1,22 @@
+#!/bin/sh
+#
+# /usr/local/sbin/localshowkannelsms
+# Copyright 2010 Jonas Smedegaard <dr@jones.dk>
+#
+# List recently handles sms'es
+#
+
+logfilecount="${logfilecount:-2}"
+
+lslogfiles() {
+ if [ -n "$logfilecount" ]; then
+ find /var/log/kannel -name 'smsbox.log*' | sort -n -t. -k3 -r | tail -n "$logfilecount"
+ else
+ find /var/log/kannel -name 'smsbox.log*' | sort -n -t. -k3 -r
+ fi
+}
+
+#lslogfiles | xargs zcat -f | perl -ne '/^(\S+ +\S+) .*Starting to service <(.*)> from <.*> to <\+4530959593>$/ and print "$1 $2\n"; /^\S+ (\S+) .*sendsms sender:<\S+:\+4530959593> .*msg:<(.*?)>?$/ and print " $1 $2\n"; /^(...................)(?<!\d\d\d\d\-\d\d\-\d\d \d\d:\d\d:\d\d)(.*?)>?$/ and print " $1$2\n"'
+lslogfiles | xargs zcat -f | perl -ne '/^(\S+ +\S+) .*Starting to service <(.*)> from <.*> to <\+4530640636>$/ and print "$1 $2\n"; /^\S+ (\S+) .*sendsms sender:<\S+:\+4530959593> .*msg:<(.*?)>?$/ and print " $1 $2\n"; /^(...................)(?<!\d\d\d\d\-\d\d\-\d\d \d\d:\d\d:\d\d)(.*?)>?$/ and print " $1$2\n"'
+
+exit 0