[Mono-list] Script to start mod-mono-server and httpd

John (Doc) Soliday jlsolida@gapac.com
05 Sep 2003 10:34:44 -0400


Rather than attempt to modify the /etc/rc.d/init.d/httpd file, I decided
to approach this a different way.  I will probably create
/etc/rc.d/init.d/mono script eventually, but for now I did the following
scripts (start and stop).  /usr/local/xsp is the xsp directory and it
contains a mono sub-dir as mentioned in previous emails.  You can put
these in /usr/local/bin or something else that is in your path.

start_mono_and_httpd
====================
#! /bin/sh

echo "Starting 'mono mod-mono-server.exe'"
cd /usr/local/xsp
mono mod-mono-server.exe &
PROCEED="no"
while [ "$PROCEED" = "no" ];do
  echo "Waiting for /tmp/mod_mono_server to be created"
  if [ -S "/tmp/mod_mono_server" ];then
    echo "Fixing ownership of /tmp/mod_mono_server"
    chown apache:apache /tmp/mod_mono_server
    PROCEED="yes"
  fi
  sleep 5
done
/etc/rc.d/init.d/httpd start

stop_mono_and_apache
====================
#! /bin/sh

/etc/rc.d/init.d/httpd stop
cd /usr/local/xsp
PROCESS=`ps -ef | grep 'mod\-mono\-server.exe'`
echo "$PROCESS"
for PID in `echo "$PROCESS" | awk '{print $2}'`;do
  echo "Killing $PID"
  kill $PID
done

-- 
John (Doc) Soliday
Commerce Services
(404) 652-3343
jlsolida@gapac.com