summaryrefslogtreecommitdiff
path: root/www/hiawatha/files/hiawatha.sh
blob: 679b96f37f235fc8844758636d489e50d17762f5 (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
#!@RCD_SCRIPTS_SHELL@
#
# $NetBSD: hiawatha.sh,v 1.2 2003/08/04 11:00:32 jmmv Exp $
#
# PROVIDE: hiawatha
# REQUIRE: DAEMON

PREFIX=@PREFIX@
PKG_SYSCONFDIR=@PKG_SYSCONFDIR@

pidfile=/var/run/hiawatha.pid

if [ -z "${JAVA_HOME}" ]
then
	JAVA_HOME=${PREFIX}/java
	export ${JAVA_HOME}
fi

CLASSPATH=${PREFIX}/lib/java/hiawatha/hiawatha.jar:${PREFIX}/lib/java/hiawatha/xsls.jar:${PREFIX}/lib/java/saxon.jar:${CLASSPATH}
export CLASSPATH

name="hiawatha"
command="${JAVA_HOME}/bin/java com.pault.hiawatha.Server ${PKG_SYSCONFDIR}/hiawatha.cfg"

if [ ! -d /var/spool/hiawatha ]
then
	echo "you must create /var/spool/hiawatha and any needed spool directories therein before starting hiawatha"
	exit 0
fi

cmd=${1:-start}

case ${cmd} in
	start)
		echo "Starting ${name}."
		cd /var/spool/hiawatha 
		${command}&
		echo $! > ${pidfile}
		;;

	stop)
		echo "Stopping ${name}."
		kill `cat ${pidfile}`
		rm ${pidfile}
		;;

	restart)
		( $0 stop )
		sleep 5
		$0 start
		;;

	*)
		echo 1>&2 "Usage: $0 [restart|start|stop]"
		exit 1
		;;
esac
exit 0