#!/bin/sh
# Haserl wrapper to enable file upload up to 10MB
# and to prevent multiple instances of the same cgi file                                
# Drawback: The browser may get empty page, because the script
# may not be executed. In this case a server busy
# page is served to the browser
ulimit -u 15
INSTANCE=$(ps | grep "haserl" | grep -v "grep" | grep -v "wrapper" | grep "$@")

if [ "$INSTANCE" != "" ] ; then
	# display "server busy"
	/usr/bin/haserl -u 1024 /usr/local/www/sys/cgi-bin/server_busy.cgi
else
	# no instances-run this script
	/usr/bin/haserl -u 16384 "$@"
fi
