Wie kann ich xsp installieren, um es als Daemon auszuführen? Ich führe mein /etc/init.d/xsp
Skript aus (siehe unten), das mit der folgenden Statusmeldung beendet wird:
Listening on address: 0.0.0.0
Root directory: /var/www/asptest
Listening on port: 8080 (non-secure)
Hit Return to stop the server.
Ich denke mein Linux AMI basiert auf Redhat / Centos, daher gibt es keinen Start-Stop-Daemon. Hier ist mein
/etc/init.d/xsp
Skript:
#!/bin/sh
### BEGIN INIT INFO
# Provides: xsp
# Required-Start: $local_fs $remote_fs $network
# Required-Stop: $local_fs $remote_fs $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Asp.Net testing server startup script.
# Description: Asp.Net testing server startup script.
### END INIT INFO
PATH=/sbin:/usr/sbin:/bin:/usr/bin
DESC=xsp
NAME=xsp
DAEMON=/usr/bin/xsp4
DEFAULT=/etc/default/$NAME
DAEMON_ARGS="--nonstop --root /var/www/asptest"
#DAEMON_ARGS="--nonstop --root /usr/lib/xsp/test"
MONO_SHARED_DIR=/var/run/$NAME
PIDFILE=/var/run/$NAME.pid
SCRIPTNAME=/etc/init.d/$NAME
[ -x "$DAEMON" ] || exit 0
[ -f "$DEFAULT" ] && . $DEFAULT
. /lib/lsb/init-functions
if [ ! -e $MONO_SHARED_DIR ]; then
mkdir $MONO_SHARED_DIR
chown $user:$group $MONO_SHARED_DIR
fi
chk_start() {
if [ -f "$PIDFILE" ]; then
xpid=`head -1 "$PIDFILE"`
xps=`ps -p $xpid | wc -l`
if [ "$xps" != "1" ]; then
echo -n "Xsp is running"
return 1
fi
fi
return 0
}
do_start()
{
export MONO_SHARED_DIR
daemon --user $USER --pidfile /var/run/${NAME}.pid $DAEMON --port $port --address $address $DAEMON_ARGS &
}
do_stop()
{
if [ -e "$PIDFILE" ] ; then
kill -9 `head -1 "$PIDFILE"` 1>/dev/null 2>&1
rm -f "$PIDFILE"
fi
}
case "$1" in
start)
if chk_start ; then
do_start
fi
;;
stop)
do_stop
;;
status)
;;
restart|force-reload)
do_stop
do_start
;;
*)
echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2
exit 3
;;
esac
Jede Hilfe dankbar.