#!/bin/sh

if [ $# -ne 1 ]; then
  echo "Usage:\n  $0 <db_name>"
  exit 1
fi

watch -n 5 "mysql -h localhost -u root -t '$1' --disable-pager -t -e 'SELECT count(path) as MESSAGE, method_id, processing as run, processing_node as node FROM message WHERE processing_node > -1 GROUP BY  method_id, processing, processing_node; SELECT count(path) as MESSAGE_QUEUE, method_id, processing as run, processing_node as node FROM message_queue WHERE processing_node > -1 GROUP BY method_id, processing, processing_node' "