#!/bin/sh

dumpfile="/tmp/mathlm.dump"

eval `ps -auxww |grep mathlm |grep -v grep | awk '{print "id="$2}'`

if [ -z "$id" ] ; then
   echo "mathlm is not currently running on this machine (`hostname`)."
   echo "You must run monitorlm on the machine being used as a Mathematica"
   echo "license server."
   exit 1
fi

kill -USR1 $id > /dev/null 2>&1

if [ $? -eq 1 ] ; then
   echo "Mathlm is running under a different user id.  No more"
   echo "information is available."
   exit 1
fi

sleep 1 # wait for file to be written

cat $dumpfile | tail +8

rm $dumpfile
exit 0
