summaryrefslogtreecommitdiff
blob: ead2d6dcd7f4af87b10e9af75e5500f5a1ffb257 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/sbin/runscript
# Copyright 1999-2005 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/dev-dotnet/xsp/files/mod-mono-server.initd,v 1.2 2005/02/17 06:06:09 trapni Exp $

depend() {
	use net
	after dotnet
}

start() {
	[ -z "$MonoServerRootDir" ] && \
	MonoServerRootDir="/usr/share/doc/xsp/test"
	[ -z "$MonoApplications" ] && \
	MonoApplications="/mono:/usr/share/doc/xsp/test,/:."
	[ -z "$UnixSocketFileName" ] && \
	UnixSocketFileName="/tmp/mod_mono_server"
	[ -z "$MonoServerAddress" ] && \
	MonoServerAddress=127.0.0.1
	[ -z "$MonoServerPort" ] && \
	MonoServerPort=8080

	MONO_SERVER_OPTS="--root ${MonoServerRootDir} \
--applications ${MonoApplications} --nonstop"

	[ -n "$MonoApplicationsConfigDir" ] && \
	MONO_SERVER_OPTS="${MONO_SERVER_OPTS} \
--appconfigdir ${MonoApplicationsConfigDir}"

	case "$MonoServerChannel" in
	"tcp" )
		MONO_SERVER_OPTS="${MONO_SERVER_OPTS} \
--address ${MonoServerAddress} --port ${MonoServerPort}"
		;;
	
	"unix" )
		[ -f "$UnixSocketFileName" ] && rm -f $UnixSocketFileName
		MONO_SERVER_OPTS="${MONO_SERVER_OPTS} \
--filename ${UnixSocketFileName}"
		;;

	* )
		eerror "Please set a valid value for MonoServerChannel"
		return 1
		;;
	esac

	export MONO_SHARED_DIR=/tmp

	ebegin "Starting mod-mono-server"

	start-stop-daemon --quiet --start \
		--background \
		--make-pidfile \
		--pidfile /var/run/aspnet/mod-mono-server.pid \
		--chuid apache \
		--exec /usr/bin/mod-mono-server \
		-- $MONO_SERVER_OPTS

	eend $?
}

stop() {
	ebegin "Stopping mod-mono-server"

	start-stop-daemon -o --quiet --stop \
		--pidfile /var/run/aspnet/mod-mono-server.pid

	eend $?
}