updated on Thu Jan 26 16:09:46 UTC 2012
[aur-mirror.git] / redmine-mysql-git / redmine.init
blobf82cd235f65811cd781e4b394d5eaa59d1466036
1 #!/bin/bash
2 # $Id$
3 daemon_name=redmine-webrick
5 . /etc/rc.conf
6 . /etc/rc.d/functions
7 . /etc/conf.d/redmine.conf
9 RUBY_CMD=/usr/bin/ruby
11 get_pid() {
12 if [ -f $PIDFILE ]; then
13 cat $PIDFILE
17 case "$1" in
18 start)
19 stat_busy "Starting $daemon_name standalone webserver"
21 PID=$(get_pid)
22 if [ -z "$PID" ]; then
23 [ -f $PIDFILE ] && rm -f $PIDFILE
24 # RUN
25 su redmine -c "${RUBY_CMD} ${REDMINE_HOME}/script/server -d -e ${REDMINEDB} > ${REDMINE_LOG} 2>&1"
26 # did the daemon start correctly?
27 if [ $? -gt 0 ]; then
28 echo "daemon could not get started successfully"
29 stat_fail
30 exit 1
31 else
32 if [ -f $PIDFILE ]; then
33 add_daemon $daemon_name
34 stat_done
35 else
36 echo "daemon has not created pid-file"
37 stat_fail
38 exit 1
41 else
42 stat_fail
43 exit 1
47 stop)
48 stat_busy "Stopping $daemon_name webserver"
49 PID=$(get_pid)
50 # KILL
51 [ ! -z "$PID" ] && kill -9 $PID &> /dev/null
53 if [ $? -gt 0 ]; then
54 stat_fail
55 exit 1
56 else
57 rm -f $PIDFILE &> /dev/null
58 rm_daemon $daemon_name
59 stat_done
63 restart)
64 $0 stop
65 sleep 3
66 $0 start
69 echo "usage: $0 {start|stop|restart}"
70 esac
71 exit 0