#!/bin/sh  

# Filename:  check_locks
# Description:  This script checks the lock table in the database for
# records.  If they are older than 1 hour (an abnormal condition), a message
# is sent to the sysop.
# Author:	Greg Shaw
# Created:	6/13/96

# BBSDIR set?
if [ "$BBSDIR" = "" ]; then
	echo Please run this script as user bbs.
	exit 1
fi

# right number of arguments?

# check for msql
if [ ! -x $BBSDIR/msql/bin/msql ]; then
	echo Please compile and install the mSQL package prior to executing
	echo this utility.
	exit 1
fi

# figure out what an hour ago was
HOUR=3600
now=`date +"%s"`
then=`echo $now-$HOUR | bc`

$BBSDIR/msql/bin/msql rocat <<EOF

select username from lock where date < $then\g 
EOF 

