#!/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 / and print "$1 $2\n"; /^\S+ (\S+) .*sendsms sender:<\S+:.*msg:<(.*?)>?$/ and print " $1 $2\n"; /^(...................)(??$/ and print " $1$2\n"' exit 0