summaryrefslogtreecommitdiff
blob: 7d860603197a016bdc2b1f25519211f883dd939d (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
#!/sbin/runscript
# Copyright 1999-2009 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/www-apps/chiliproject/files/chiliproject.initd,v 1.1 2010/02/10 16:40:42 matsuu Exp $

RAILS_ENV=${RAILS_ENV:-production}
CHILIPROJECT_DIR=${CHILIPROJECT_DIR:-/var/lib/chiliproject}
CHILIPROJECT_ADDRESS=${CHILIPROJECT_ADDRESS:-localhost}
CHILIPROJECT_PORT=${CHILIPROJECT_PORT:-3000}
CHILIPROJECT_USER=${CHILIPROJECT_USER:-chiliproject}
CHILIPROJECT_GROUP=${CHILIPROJECT_GROUP:-chiliproject}
CHILIPROJECT_PIDFILE="${CHILIPROJECT_DIR}/tmp/pids/server.pid"

depend() {
	use apache2 git-daemon mysql net postgresql svnserve
}

start() {
	ebegin "Starting chiliproject"
	cd "${CHILIPROJECT_DIR}"
	start-stop-daemon --start --quiet --chuid ${CHILIPROJECT_USER}:${CHILIPROJECT_GROUP} \
		--pidfile "${CHILIPROJECT_PIDFILE}" \
		--exec /usr/bin/ruby "${CHILIPROJECT_DIR}"/script/server -- \
		--daemon --environment=${RAILS_ENV} \
		--binding=${CHILIPROJECT_ADDRESS} --port=${CHILIPROJECT_PORT} \
		${CHILIPROJECT_OPTS}
	eend $?
}

stop() {
	ebegin "Stopping chiliproject"
	cd "${CHILIPROJECT_DIR}"
	start-stop-daemon --stop --quiet --pidfile "${CHILIPROJECT_PIDFILE}"
	eend $?
}