Restart Baan licd License Daemon

Baan has design flaws in its license scheme, there is no way to free a license that is left by a hung session or disconnected session that did not go through the logout process. Because the number of licenses is finite and expensive after a while all the licenses are used up. The Baan software uses this “feature” to sell more licenses to ignorant customers. The solution is to restart the license daemon, licd to free all the licenses, but this has the disadvantage of booting everyone off the Baan system for several minutes until the license daemon is restarted.

When using this shell script the sessions are rubbed out and unable to connect for a couple minutes as the licd port connection takes a while to die off. Used on Sun OS. Usually run when no one should be using the system, like during a planned shutdown.

###################### cut here ##########################
#!/bin/ksh
# Restart the licd6.1
#
# Baan has design flaws in its license scheme.  
# Licenses stay in a used state and can only be freed by 
# restarting the license daemon, licd.
# NOTE: run as root


# Check if the Baan licd process exists, and print the pid.
check_licd () {
   test $(ps -ef| grep licd6.1 | grep -v grep | /usr/bin/nawk '{print $2}') &&
   print "PID of licd6.1: " "$(ps -ef| grep ${LICD_NAME} | grep -v grep | /usr/bin/nawk '{print $2}')"
}


# Check if the TCP port licd uses is not connected to processes.
check_port () {
   test $(netstat -a | egrep "${LICD_HOST}\.${LICD_PORT} " | wc -l) -ne 0 && return 0
}

###########################################
# Main

export BSE=/apps/baan/bse
export BSE_TMP=/apps/baan/bse/tmp
export LICD_NAME=licd6.1              # Name of the license process
export LIC_MONITOR_NAME=licmon6.1     # Name of the license monitor process
export LICD_PORT=6003              # Port that the licd uses
export LICD_HOST=hostname          # Host of licd

${BSE}/bin/${LIC_MONITOR_NAME} -k;    # Kill the licd 

print "Checking ports every 20 seconds..."
while check_port
do
 sleep 20
 print "Number of connections: $(netstat -a | egrep "${LICD_HOST}\.${LICD_PORT} " | wc -l)"

done

print "Start the licd"

${BSE}/bin/${LICD_NAME};
check_no_licd

###################### cut here ##########################

Leave a Reply

Your email address will not be published. Required fields are marked *