[Pkg-mono-svn-commits] rev 432 - xsp-snapshot/trunk/debian/official
Pablo Fischer
pabl0-guest@haydn.debian.org
Mon, 15 Mar 2004 19:51:26 -0700
Author: pabl0-guest
Date: 2004-03-15 19:50:59 -0700 (Mon, 15 Mar 2004)
New Revision: 432
Modified:
xsp-snapshot/trunk/debian/official/mono-server.init
xsp-snapshot/trunk/debian/official/mono-xsp.init
Log:
* mono-xsp.init:
+ Added a new rule: Verify if the xsp daemon is already running, if it
is running, print an error an exit, so we keep a good pid control system
in /var/run
+ Removed some stupid debug messages in spanish
+ Fixed the should_restart, it was always returning true
* mono-server.init:
+ Removed some stupid debug messages in spanish
+ Fixed the should_restart, it was always returning true
+ If libapache is not installed, we should print a message AND exit..
Modified: xsp-snapshot/trunk/debian/official/mono-server.init
===================================================================
--- xsp-snapshot/trunk/debian/official/mono-server.init 2004-03-16 02:49:59 UTC (rev 431)
+++ xsp-snapshot/trunk/debian/official/mono-server.init 2004-03-16 02:50:59 UTC (rev 432)
@@ -14,8 +14,10 @@
DESC="Mono Server, mod-mono-server"
DEFAULT=/etc/default/$NAME
CFGDIR=/etc/$NAME
-VIRTUALFILE=$CFGDIR/virtual.conf
+VIRTUALFILE=$CFGDIR/mono-server-hosts.conf
+virtual_dirs=`mono-server-reader.conf`
+
prepare_socket() {
. $DEFAULT
if [ ! -d /tmp/.mono-server ]; then
@@ -43,6 +45,7 @@
if [ ! -f /usr/lib/apache/1.3/500mod_mono.info ]; then
echo "There's no need to start me if you don't have libapache-mod-mono, sorry!"
+ exit 0
fi
if [ ! -x $DAEMON ]; then
@@ -56,18 +59,33 @@
exit 0
fi
+ if [[ $virtual_dirs = *Sorry* ]]; then
+ echo "Sorry, I found a missconfiguration in /etc/mono-server/mono-server-hosts.conf, fix it, or dpkg-reconfigure mono-server/virtua\lhosts packages"
+ exit 0
+ fi
+
+ if [[ -z $virtual_dirs ]]; then
+ echo "Sorry, I found an empty /etc/mono-server/mono-server-hosts.conf"
+ exit 0
+ fi
- hostsempty=`mono-vhostmanager print --config-file=$VIRTUALFILE`
- if [[ $hostsempty = *NHF* || $hostsempty = *FNE* ]]; then
- echo "Sorry, you don't have any hosts. I suggest you to download asp.net-examples"
- exit 0
- fi
-
prepare_socket
}
should_stop() {
+ if [ -f /var/run/$NAME ]; then
+ # Are we really running monoserver?
+ monoserver_pid=`cat /var/run/$NAME`
+ monoserver_ps=`ps -p $monoserver_pid | wc -l`
+ # Are there any process running by that pid?
+ if [ "$xsp_ps" = "2" ]; then
+ return 0
+ else
+ return 1
+ fi
+ fi
+
if [ ! -f /var/run/$NAME ]; then
echo "Sorry, mono-server is not running at the moment"
exit 0
@@ -76,7 +94,7 @@
monoserver_pid=`cat /var/run/$NAME`
monoserver_ps=`ps -p $monoserver_pid | wc -l`
# Are there any process running by that pid?
- if [ $monoserver_ps = "1" ]; then
+ if [ "$monoserver_ps" = "1" ]; then
echo "Sorry, mono-server is not running at the moment"
exit 0
fi
@@ -84,28 +102,22 @@
}
should_restart() {
- if [ ! -f /var/run/$NAME ]; then
- return 255
- else
- # Are we really running xsp?
+ if [ -f /var/run/$NAME ]; then
+ # Are we really running monoserver?
monoserver_pid=`cat /var/run/$NAME`
monoserver_ps=`ps -p $monoserver_pid | wc -l`
# Are there any process running by that pid?
- if [ $monoserver_ps = "1" ]; then
- return 255
+ if [ "$monoserver_ps" = "2" ]; then
+ return 0
+ else
+ return 1
fi
- fi
+ fi
}
case "$1" in
start)
should_start
- virtual_dirs=`mono-server-reader.conf`
- if [[ $virtual_dirs = *Sorry* ]]; then
- echo "Sorry, I found a missconfiguration in /etc/mono-server/mono-server-hosts.conf"
- echo "Try to run mono-xsp-reader.conf for more data"
- exit 0
- fi
. $DEFAULT
echo -n "Starting $DESC: $NAME"
start-stop-daemon --start --background --make-pidfile \
@@ -127,19 +139,13 @@
# option to the "reload" entry above. If not, "force-reload" is
# just the same as "restart".
#
- if [ ! should_restart ]; then
+ if should_restart ; then
echo "Restarting $DESC: $NAME"
start-stop-daemon --stop --quiet --pidfile /var/run/$NAME
sleep 1
fi
should_start
- virtual_dirs=`mono-server-reader.conf`
- if [[ $virtual_dirs = *Sorry* ]]; then
- echo "Sorry, I found a missconfiguration in /etc/mono-server/mono-server-hosts.conf"
- echo "Try to run mono-xsp-reader.conf for more data"
- exit 0
- fi
. $DEFAULT
start-stop-daemon --start --background --make-pidfile \
--quiet --pidfile /var/run/$NAME \
Modified: xsp-snapshot/trunk/debian/official/mono-xsp.init
===================================================================
--- xsp-snapshot/trunk/debian/official/mono-xsp.init 2004-03-16 02:49:59 UTC (rev 431)
+++ xsp-snapshot/trunk/debian/official/mono-xsp.init 2004-03-16 02:50:59 UTC (rev 432)
@@ -14,8 +14,9 @@
DESC="XSP WebServer"
DEFAULT=/etc/default/$NAME
CFGDIR=/etc/xsp
-VIRTUALFILE=$CFGDIR/virtual.conf
+VIRTUALFILE=$CFGDIR/mono-xsp-hosts.conf
+virtual_dirs=`mono-xsp-reader.conf`
should_start() {
if [ -e $DEFAULT ]; then
@@ -37,12 +38,26 @@
exit 0
fi
+ if [[ $virtual_dirs = *Sorry* ]]; then
+ echo "Sorry, I found a missconfiguration in /etc/xsp/mono-xsp-hosts.conf, fix it, or dpkg-reconfigure mono-xsp/virtualhosts packages"
+ exit 0
+ fi
+
+ if [[ -z $virtual_dirs ]]; then
+ echo "Sorry, I found an empty /etc/xsp/mono-xsp-hosts.conf"
+ exit 0
+ fi
- hostsempty=`mono-vhostmanager print --config-file=$VIRTUALFILE`
- if [[ $hostsempty = *NHF* || $hostsempty = *FNE* ]]; then
- echo "Sorry, you don't have any hosts. I suggest you to download asp.net-examples"
- exit 0
+ if [ -f /var/run/$NAME ]; then
+ # Are we really running xsp?
+ xsp_pid=`cat /var/run/$NAME`
+ xsp_ps=`ps -p $xsp_pid | wc -l`
+ if [ "$xsp_ps" != "1" ]; then
+ echo "Sorry, there is already a xsp running, stop it first"
+ exit 0
+ fi
fi
+
}
should_stop() {
@@ -54,7 +69,7 @@
xsp_pid=`cat /var/run/$NAME`
xsp_ps=`ps -p $xsp_pid | wc -l`
# Are there any process running by that pid?
- if [ $xsp_ps = "1" ]; then
+ if [ "$xsp_ps" = "1" ]; then
echo "Sorry, mono-xsp is not running at the moment"
exit 0
fi
@@ -62,15 +77,15 @@
}
should_restart() {
- if [ ! -f /var/run/$NAME ]; then
- return 255
- else
+ if [ -f /var/run/$NAME ]; then
# Are we really running xsp?
xsp_pid=`cat /var/run/$NAME`
xsp_ps=`ps -p $xsp_pid | wc -l`
# Are there any process running by that pid?
- if [ $xsp_ps = "1" ]; then
- return 255
+ if [ "$xsp_ps" = "2" ]; then
+ return 0
+ else
+ return 1
fi
fi
}
@@ -78,12 +93,6 @@
case "$1" in
start)
should_start
- virtual_dirs=`mono-xsp-reader.conf`
- if [[ $virtual_dirs = *Sorry* ]]; then
- echo "Sorry, I found a missconfiguration in /etc/xsp/mono-xsp-hosts.conf"
- echo "Try to run mono-xsp-reader.conf for more data"
- exit 0
- fi
. $DEFAULT
echo -n "Starting $DESC: $NAME"
start-stop-daemon --start --background --make-pidfile \
@@ -105,19 +114,13 @@
# just the same as "restart".
#
- if [ ! should_restart ]; then
+ if should_restart ; then
echo "Restarting $DESC: $NAME"
start-stop-daemon --stop --quiet --pidfile /var/run/$NAME
sleep 1
fi
-
+
should_start
- virtual_dirs=`mono-xsp-reader.conf`
- if [[ $virtual_dirs = *Sorry* ]]; then
- echo "Sorry, I found a missconfiguration in /etc/xsp/mono-xsp-hosts.conf"
- echo "Try to run mono-xsp-reader.conf for more data"
- exit 0
- fi
. $DEFAULT
echo "Starting $DESC: $NAME"
start-stop-daemon --start --background --make-pidfile \