[Pkg-mono-svn-commits] rev 539 - xsp-snapshot/trunk/debian/official
Pablo Fischer
pabl0-guest@haydn.debian.org
Sat, 10 Apr 2004 13:04:36 -0600
Author: pabl0-guest
Date: 2004-04-10 13:04:26 -0600 (Sat, 10 Apr 2004)
New Revision: 539
Modified:
xsp-snapshot/trunk/debian/official/mono-server-update.conf
xsp-snapshot/trunk/debian/official/mono-xsp-update.conf
Log:
The update script has the 'power' of restart the server (by default) if
the md5sum of the first -host.conf file is different to the new one.
Modified: xsp-snapshot/trunk/debian/official/mono-server-update.conf
===================================================================
--- xsp-snapshot/trunk/debian/official/mono-server-update.conf 2004-04-10 16:42:15 UTC (rev 538)
+++ xsp-snapshot/trunk/debian/official/mono-server-update.conf 2004-04-10 19:04:26 UTC (rev 539)
@@ -3,6 +3,7 @@
MONOSERVER_confdir="/etc/mono-server"
MONOSERVER_conffile=$MONOSERVER_confdir/mono-server-hosts.conf
MONOSERVER_comments=no
+MONOSERVER_restart=yes
usage() {
cat <<EOF
@@ -11,12 +12,13 @@
--help - Show this message
--output file - write the output to other file instead of ${MONOSERVER_conffile}
--confdir directory - read the configuration files in a directory instead of ${MONOSERVER_confdir}
+ --norestart - Do not restart the daemon (by default, it will)
EOF
}
#Read the commandline
TEMP=$(getopt -n mono-server-update.conf \
- -l output:,confdir:,help -- \
+ -l output:,confdir:,norestart,help -- \
: "$@")
@@ -27,6 +29,10 @@
usage
exit 0
;;
+ --norestart)
+# shift
+ MONOSERVER_restart="no"
+ ;;
--output)
shift
MONOSERVER_conffile="$1"
@@ -60,14 +66,53 @@
exit 1
fi
+if [ -e "$MONOSERVER_conffile" ]; then
+ md5_orig=`md5sum $MONOSERVER_conffile | awk '{print $1}'`
+else
+ md5_orig="0"
+fi
+
# based on exim4-update.conf
errormessage () {
# pretty-print messages of arbitrary length (no trailing newline)
echo "$*" | fold -s -w ${COLUMNS:-80} >&2;
}
+restart_firsttime() {
+ confd="${MONOSERVER_confd}"
+ almost_empty="`ls -lA $confd | wc -l`"
+ if [ "$almost_empty" = "2" ] ; then
+ echo "Starting Mono Server: mono-server"
+ /etc/init.d/mono-server start > /dev/null 2>&1 || true
+ fi
+}
+restart_monoserver() {
+ #Ok, include the default file
+ . "/etc/default/mono-server"
+ #MonoServer is running?
+ if [ -f /var/run/mono-server ]; then
+ # Are we really running xsp?
+ monoserver_pid=`cat /var/run/mono-server`
+ monoserver_ps=`ps -p $monoserver_pid | wc -l`
+ # Are there any process running by that pid?
+ if [ "$xsp_ps" != "1" ]; then
+ if [ "$start_boot" = "true" ]; then
+ echo "Restarting Mono Server: mono-server"
+ /etc/init.d/mono-server restart > /dev/null 2>&1 || true
+ fi
+ else
+ restart_firsttime
+ fi
+ else
+ if [ "$start_boot" = "true" ]; then
+ restart_firsttime
+ fi
+ fi
+}
+
+
# stolen from /etc/X11/Xsession
run_parts () {
# until run-parts --noexec is implemented
@@ -123,3 +168,14 @@
mv -f ${MONOSERVER_conffile}.tmp ${MONOSERVER_conffile}
chmod 644 ${MONOSERVER_conffile}
+
+#re-check the md5
+md5_new=`md5sum $MONOSERVER_conffile | awk '{print $1}'`
+
+#The orig and new.. are the same?
+if [ "$md5_new" != "$md5_orig" ]; then
+ #So, restart the server.. but.. should we?
+ if [ "${MONOSERVER_restart}" = "yes" ]; then
+ restart_monoserver
+ fi
+fi
Modified: xsp-snapshot/trunk/debian/official/mono-xsp-update.conf
===================================================================
--- xsp-snapshot/trunk/debian/official/mono-xsp-update.conf 2004-04-10 16:42:15 UTC (rev 538)
+++ xsp-snapshot/trunk/debian/official/mono-xsp-update.conf 2004-04-10 19:04:26 UTC (rev 539)
@@ -3,7 +3,9 @@
MONOXSP_confdir="/etc/xsp"
MONOXSP_conffile=$MONOXSP_confdir/mono-xsp-hosts.conf
MONOXSP_comments=no
+MONOXSP_restart=yes
+
usage() {
cat <<EOF
$0 - Generate the XSP Host Configuration
@@ -11,12 +13,13 @@
--help - Show this message
--output file - write the output to other file instead of ${MONOXSP_conffile}
--confdir directory - read the configuration files in a directory instead of ${MONOXSP_confdir}
+ --norestart - Do not restart the daemon (by default, it will)
EOF
}
#Read the commandline
TEMP=$(getopt -n mono-xsp-update.conf \
- -l output:,confdir:,help -- \
+ -l output:,confdir:,norestart,help -- \
: "$@")
@@ -27,6 +30,10 @@
usage
exit 0
;;
+ --norestart)
+# shift
+ MONOXSP_restart="no"
+ ;;
--output)
shift
MONOXSP_conffile="$1"
@@ -60,6 +67,11 @@
exit 1
fi
+if [ -e "$MONOXSP_conffile" ]; then
+ md5_orig=`md5sum $MONOXSP_conffile | awk '{print $1}'`
+else
+ md5_orig="0"
+fi
# based on exim4-update.conf
errormessage () {
@@ -67,7 +79,39 @@
echo "$*" | fold -s -w ${COLUMNS:-80} >&2;
}
+restart_firsttime() {
+ confd="${MONOXSP_confd}"
+ almost_empty="`ls -lA $confd | wc -l`"
+ if [ "$almost_empty" = "2" ] ; then
+ echo "Starting XSP WebServer: mono-xsp"
+ /etc/init.d/mono-xsp start > /dev/null 2>&1 || true
+ fi
+}
+restart_xsp() {
+ #Ok, include the default file
+ . "/etc/default/mono-xsp"
+ #MonoServer is running?
+ if [ -f /var/run/mono-xsp ]; then
+ # Are we really running xsp?
+ xsp_pid=`cat /var/run/mono-xsp`
+ xsp_ps=`ps -p $xsp_pid | wc -l`
+ # Are there any process running by that pid?
+ if [ "$xsp_ps" != "1" ]; then
+ if [ "$start_boot" = "true" ]; then
+ echo "Restarting XSP WebServer: mono-xsp"
+ /etc/init.d/mono-xsp restart > /dev/null 2>&1 || true
+ fi
+ else
+ restart_firsttime
+ fi
+ else
+ if [ "$start_boot" = "true" ]; then
+ restart_firsttime
+ fi
+ fi
+}
+
# stolen from /etc/X11/Xsession
run_parts () {
# until run-parts --noexec is implemented
@@ -123,3 +167,14 @@
mv -f ${MONOXSP_conffile}.tmp ${MONOXSP_conffile}
chmod 644 ${MONOXSP_conffile}
+
+#re-check the md5
+md5_new=`md5sum $MONOXSP_conffile | awk '{print $1}'`
+
+#The orig and new.. are the same?
+if [ "$md5_new" != "$md5_orig" ]; then
+ #So, restart the server.. but.. should we?
+ if [ "${MONOXSP_restart}" = "yes" ]; then
+ restart_xsp
+ fi
+fi