#! /bin/sh
#
# Name: unlock_cdbs.s
#
# Description: Issues a DB query to unlock a CDBS delivery number in the
#              database.
#
# Called by:  various other scripts
#
# Returns:    0 - lock successfully released or no lock was in place
#             1 - failure to release lock
#
#------------------------------------------------------------------------
export CDBS_SERVER CDBS_DB
i=`unlock_cdbs_sql.s`
#echo $i
if test `echo $i | fgrep -i "held" | wc -l`  -ne 0
then
 echo "no lock was held"
 exit 0
fi
echo $CDBS_DB
if test `echo $i | fgrep -i "released" | wc -l`  -ne 0
then
 echo "lock released"
 exit 0
fi
echo "lock not released"
exit 1
