[Mono-list] Debian Package + LibApache Mod_mono

Michael Ott Michael Ott <michael@zolnott.de>
Wed, 28 Jan 2004 01:04:15 +0100


--nFreZHaLTZJo0R7j
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

Hello Stuart!

> Pablo Fischer wrote:
> >Thanks for the report!
> >
> >I'll work tomorrow in it and work in the service (init.d).
> 
> I found out why this was failing: my /tmp/mod_mono_server already 
> existed and was owned by a different user, so mod-mono-server.exe didn't 
> have permission to delete it.

I have written a small application starting and stopping mono on boot or
on shutdown.

Here it is. Perhaps you can use some lines of this terrible :-D code
           
CU        
         
  Michael  
          
--                                                       
           Michael Ott, e-mail: michael@zolnott.de, www.zolnott.de           
I am registered as user #275453 with the Linux Counter, http://counter.li.org.

--nFreZHaLTZJo0R7j
Content-Type: text/plain; charset=iso-8859-1
Content-Disposition: attachment; filename=mod_mono
Content-Transfer-Encoding: 8bit

#!/bin/sh
#
# mod_mono	Start the mod_mono-server

NAME=mod_mono
MONOPIDFILE=/var/run/mono.pid

start_mod_mono() {

	tmp=`ps ax | grep -m 1 "/usr/bin/mono"`
	tmp=`echo $tmp | grep "/usr/bin/mod-mono-server.exe" | awk '{print $1}'`
	if [ $tmp ]; then
		echo -n "$NAME already started"
	else
		echo "Starting server $NAME"
		#/usr/bin/mono /usr/bin/mod-mono-server.exe --root /usr/local/share/doc/xsp/test/ --applications /mono:. --nonstop &
		/usr/bin/mono /usr/bin/mod-mono-server.exe --root /var/www/html/mono/ --applications /mono:. --nonstop &
		sleep 3
		chmod 666 /tmp/mod_mono_server
	fi

}

stop_mod_mono() {

	# (MO): Asking for an existing process for the mod-mono-server
	# (MO): Abfragen, ob es eine Prozeß für mod-mono-server schon gibt.
	tmp=`ps ax | grep -m 1 "/usr/bin/mono"`
	tmp=`echo $tmp | grep "/usr/bin/mod-mono-server.exe" | awk '{print $1}'`
	if [ $tmp ]; then
    echo -n "Stopping mod_mono"
		tmp=`ps ax | grep "/usr/bin/mono" | grep "/usr/bin/mod-mono-server.exe" | awk '{print $1}'`
		kill -9 $tmp
	else
		echo -n "$NAME is not started"
	fi

}

case "$1" in
  start)
		start_mod_mono
    ;;

  stop)
		stop_mod_mono
		echo
    ;;

  restart)
    echo "Restarting $NAME"
		stop_mod_mono
		echo
		sleep 1
		start_mod_mono
    ;;

	status)
		tmp=`ps ax | grep -m 1 "/usr/bin/mono"`
		tmp=`echo $tmp | grep "/usr/bin/mod-mono-server.exe" | awk '{print $1}'`
		if [ $tmp ]; then
			echo "$NAME is running";
		else
			echo "$NAME is not runnung";
		fi
		;;

  *)
    echo "Usage: /etc/init.d/$NAME {start|stop|restart|status}"
    exit 1
    ;;
esac

if [ $? -eq 0 ]; then
	#echo 
	exit 0
else
	echo " failed"
	exit 1
fi

--nFreZHaLTZJo0R7j--