#!/bin/sh

# Pick up definition of ${log_file} and ${parser_output}
. ./etc/nl_shared.conf

# Look at log and parsed files
ls -l ${log_file}
wc -l ${log_file}
echo

ls -l ${parser_output}*
wc -l ${parser_output}*
echo

# State files
for f in ./var/run/*.state; do
  echo "$f:"; cat $f
done
echo

query="select name as Event, count(name) as 'Count' from event group by name;"

# sqlite
echo "sqlite:"
sqlite3 ${sqlite_db} "$query"
echo

# mysql
mysqladmin --no-defaults -h localhost -s ping > /dev/null 2>&1
if [ "$?" = "0" ]; then
  echo "mysql:"
  mysql --defaults-file=${mysql_cnf} -e "$query"
fi

