aboutsummaryrefslogtreecommitdiffstats
path: root/contrib
diff options
context:
space:
mode:
authorDaniel Willmann <daniel@totalueberwachung.de>2011-09-29 12:15:07 +0200
committerHolger Hans Peter Freyther <zecke@selfish.org>2011-12-26 23:59:09 +0100
commitf8e6e1888a1cbd27470f4ddb2bb8a5ff6c361315 (patch)
tree1c5f441ff6075ef29b68670e6911ddb2f14cbffb /contrib
parent0741879e11f0deb9c7b0d5abae45aac1fce446f8 (diff)
contrib: Use explicit globs and regexps
Diffstat (limited to 'contrib')
-rwxr-xr-xcontrib/osmo_pcap_clean_old10
1 files changed, 6 insertions, 4 deletions
diff --git a/contrib/osmo_pcap_clean_old b/contrib/osmo_pcap_clean_old
index 640441e..0f4fc6c 100755
--- a/contrib/osmo_pcap_clean_old
+++ b/contrib/osmo_pcap_clean_old
@@ -30,7 +30,7 @@ cd "$BASEPATH"
do_cleanup_age()
{
- find . -ctime +$MAXAGE -name "trace-$1*" |sort -r | while read LOG; do
+ find . -ctime +$MAXAGE -name "trace-$1-*.pcap*" |sort -r | while read LOG; do
[ $VERBOSE -eq 1 ] && echo "Deleting file \"$LOG\""
rm -f "$LOG"
done
@@ -39,7 +39,7 @@ do_cleanup_age()
do_cleanup_files()
{
i=1
- find . -name "trace-$1*" |sort -r | while read LOG; do
+ find . -name "trace-$1-*.pcap*" |sort -r | while read LOG; do
if [ $i -gt $MAXFILES ]; then
[ $VERBOSE -eq 1 ] && echo "Deleting file \"$LOG\""
rm -f "$LOG"
@@ -51,7 +51,7 @@ do_cleanup_files()
do_zip()
{
i=1
- find . -name "trace-$1*" |sort -r | while read LOG; do
+ find . -name "trace-$1-*.pcap*" |sort -r | while read LOG; do
if [ $i -gt $ZIPAFTER ]; then
if [ "${LOG##*.}" != "gz" ]; then
[ $VERBOSE -eq 1 ] && echo "Compressing file \"$LOG\""
@@ -62,7 +62,9 @@ do_zip()
done
}
-find . -name "trace-*" |sed -e "s/.*trace-\(.*\)-\(.*\).pcap.*/\1/" |sort |uniq | while read CLIENT; do
+# Use an explicit pattern here
+find . -name "trace-*.pcap*" |sed -n -e "s/.*trace-\(.\+\)-[0-9]\{8\}_[0-9]\{6\}\.pcap\(\..\+\)\?/\1/p" |sort |uniq | while read CLIENT; do
+
[ $VERBOSE -eq 1 ] && echo "Cleaning logs for $CLIENT"
if [ "x$METHOD" == "xAGE" ]; then