summaryrefslogtreecommitdiff
blob: 49d59301492d5206c221efc25d27865d8e6877aa (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
#!/sbin/runscript
# Copyright 1999-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/www-apps/redmine/files/redmine.initd,v 1.5 2013/05/13 10:32:29 pva Exp $

RAILS_ENV=${RAILS_ENV:-production}
REDMINE_DIR=${REDMINE_DIR:-/var/lib/redmine}
REDMINE_ADDRESS=${REDMINE_ADDRESS:-localhost}
REDMINE_PORT=${REDMINE_PORT:-3000}
REDMINE_USER=${REDMINE_USER:-redmine}
REDMINE_GROUP=${REDMINE_GROUP:-redmine}
REDMINE_PIDFILE="/run/redmine/server.pid"

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

start_pre() {
	if [ ! -e "${REDMINE_DIR}/config/initializers/session_store.rb" ] ; then
		eerror "Execute the following command to initlize environment:"
		eerror
		eerror "# emerge --config www-apps/redmine"
		eerror
		return 1
	fi

	if [ ! -d /run/redmine ]; then
		checkpath -q -d -m 0755 -o redmine:redmine /run/redmine
	fi
}

start() {
	ebegin "Starting redmine"
	cd "${REDMINE_DIR}"
	start-stop-daemon --start --quiet --user ${REDMINE_USER}:${REDMINE_GROUP} \
		--pidfile "${REDMINE_PIDFILE}" \
		--exec /usr/bin/ruby "${REDMINE_DIR}"/script/server -- \
		--daemon --environment=${RAILS_ENV} \
		--binding=${REDMINE_ADDRESS} --port=${REDMINE_PORT} \
		${REDMINE_OPTS}
	eend $?
}

stop() {
	ebegin "Stopping redmine"
	cd "${REDMINE_DIR}"
	start-stop-daemon --signal INT --quiet --pidfile "${REDMINE_PIDFILE}"
	eend $?
}