blob: 46c04bd408a5b32f1cffbc8348782a6b08ca0993 (
plain)
- #!/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 / and print "$1 $2\n"; /^\S+ (\S+) .*sendsms sender:<\S+:.*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
|