updated on Thu Jan 26 16:09:46 UTC 2012
[aur-mirror.git] / ruby-redmine / redmine.rc
blob1686c4c1f88aa9a94dedf0d2734ad40f6f759c19
1 #!/bin/bash
3 daemon_name=redmine
4 daemon_command="ruby-1.8 /var/lib/redmine/script/server webrick -d -e production"
6 . /etc/rc.conf
7 . /etc/rc.d/functions
9 get_pid() {
10 pgrep -u redmine -f "${daemon_command}"
13 case "$1" in
14 start)
15 stat_busy "Starting $daemon_name daemon"
17 PID=$(get_pid)
18 if [ -z "$PID" ]; then
19 [ -f /var/run/$daemon_name.pid ] && rm -f /var/run/$daemon_name.pid
20 # RUN
21 su -s '/bin/sh' redmine -c "${daemon_command} &>/dev/null"
23 if [ $? -gt 0 ]; then
24 stat_fail
25 exit 1
26 else
27 echo $(get_pid) > /var/run/$daemon_name.pid
28 add_daemon $daemon_name
29 stat_done
31 else
32 stat_fail
33 exit 1
37 stop)
38 stat_busy "Stopping $daemon_name daemon"
39 PID=$(get_pid)
40 # KILL
41 [ ! -z "$PID" ] && kill -INT $PID &> /dev/null
43 if [ $? -gt 0 ]; then
44 stat_fail
45 exit 1
46 else
47 rm -f /var/run/$daemon_name.pid &> /dev/null
48 rm_daemon $daemon_name
49 stat_done
53 restart)
54 $0 stop
55 sleep 1
56 $0 start
59 status)
60 stat_busy "Checking $daemon_name status";
61 ck_status $daemon_name
65 echo "usage: $0 {start|stop|restart|status}"
66 esac
68 exit 0