From b33708b7bad20a5ced676f80f16188bb523613a6 Mon Sep 17 00:00:00 2001 From: root Date: Tue, 4 May 2010 12:03:48 +0200 Subject: Add/update sms- and Kannel-related scripts. --- localshowkannelsms | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100755 localshowkannelsms (limited to 'localshowkannelsms') 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 +# +# 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"; /^(...................)(??$/ 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"; /^(...................)(??$/ and print " $1$2\n"' + +exit 0 -- cgit v1.2.3