61
|
1 |
#!/sbin/runscript |
|
2 |
# Copyright 1999-2013 Gentoo Foundation |
|
3 |
# Distributed under the terms of the GNU General Public License v2 |
|
4 |
# $Header: /var/cvsroot/gentoo-x86/www-apps/redmine/files/redmine-2.initd,v 1.1 2013/01/07 13:39:26 matsuu Exp $ |
|
5 |
|
|
6 |
RAILS_ENV=${RAILS_ENV:-production} |
|
7 |
REDMINE_DIR=${REDMINE_DIR:-/var/lib/redmine} |
|
8 |
REDMINE_ADDRESS=${REDMINE_ADDRESS:-localhost} |
|
9 |
REDMINE_PORT=${REDMINE_PORT:-3000} |
|
10 |
REDMINE_USER=${REDMINE_USER:-redmine} |
|
11 |
REDMINE_GROUP=${REDMINE_GROUP:-redmine} |
|
12 |
REDMINE_PIDFILE="${REDMINE_DIR}/tmp/pids/server.pid" |
|
13 |
|
|
14 |
depend() { |
|
15 |
use apache2 git-daemon mysql net postgresql svnserve |
|
16 |
} |
|
17 |
|
|
18 |
start_pre() { |
|
19 |
if [ ! -e "${REDMINE_DIR}/config/initializers/secret_token.rb" ] ; then |
|
20 |
eerror "Execute the following command to initlize environment:" |
|
21 |
eerror |
|
22 |
eerror "# emerge --config www-apps/redmine" |
|
23 |
eerror |
|
24 |
return 1 |
|
25 |
fi |
|
26 |
} |
|
27 |
|
|
28 |
start() { |
|
29 |
ebegin "Starting redmine" |
|
30 |
cd "${REDMINE_DIR}" |
|
31 |
start-stop-daemon --start --quiet --user ${REDMINE_USER}:${REDMINE_GROUP} \ |
|
32 |
--pidfile "${REDMINE_PIDFILE}" \ |
|
33 |
--exec /usr/bin/ruby "${REDMINE_DIR}"/script/rails server -- \ |
|
34 |
--daemon --environment=${RAILS_ENV} \ |
|
35 |
--binding=${REDMINE_ADDRESS} --port=${REDMINE_PORT} \ |
|
36 |
${REDMINE_OPTS} |
|
37 |
eend $? |
|
38 |
} |
|
39 |
|
|
40 |
stop() { |
|
41 |
ebegin "Stopping redmine" |
|
42 |
cd "${REDMINE_DIR}" |
|
43 |
start-stop-daemon --signal INT --quiet --pidfile "${REDMINE_PIDFILE}" |
|
44 |
eend $? |
|
45 |
} |