HowTo Install Redmine on openSUSE » History » Version 1
Anonymous, 2012-12-06 18:32
start script for openSUSE 12.2
1 | 1 | Anonymous | h1. HowTo Install Redmine on openSUSE |
---|---|---|---|
2 | |||
3 | h2. Installation |
||
4 | |||
5 | The installation process can be done as described [[http://www.redmine.org/projects/redmine/wiki/RedmineInstall here]] |
||
6 | |||
7 | h2. Startscript for openSUSE 12.2 |
||
8 | |||
9 | /etc/init.d/redmine |
||
10 | <pre> |
||
11 | #! /bin/sh |
||
12 | # customized for redmine 2.1. original author below |
||
13 | # |
||
14 | # Copyright (c) 2009 SQQD GmbH Lichtentanne, Germany. |
||
15 | # |
||
16 | # Author: Gerrit Beine <gerrit.beine@gmx.de>, 2009 |
||
17 | # |
||
18 | # /etc/init.d/redmine |
||
19 | # |
||
20 | # and symbolic its link |
||
21 | # |
||
22 | # /usr/sbin/rcredmine |
||
23 | # |
||
24 | # System startup script for the redmine daemon |
||
25 | # |
||
26 | ### BEGIN INIT INFO |
||
27 | # Provides: redmine |
||
28 | # Required-Start: $remote_fs $syslog $time |
||
29 | # Should-Start: $network smtp |
||
30 | # Required-Stop: $remote_fs $syslog |
||
31 | # Should-Stop: $network smtp |
||
32 | # Default-Start: 2 3 5 |
||
33 | # Default-Stop: 0 1 6 |
||
34 | # Short-Description: Redmine Web Server |
||
35 | # Description: Redmine Web Server |
||
36 | ### END INIT INFO |
||
37 | |||
38 | REDMINE_BIN=/srv/redmine/current/script/rails |
||
39 | REDMINE_USER=user |
||
40 | REDMINE_GROUP=users |
||
41 | test -x $REDMINE_BIN || exit 5 |
||
42 | PIDFILE=/var/run/redmine.pid |
||
43 | RCFILE=/var/log/rcredmine.out |
||
44 | ENVIRONMENT=production |
||
45 | |||
46 | # Shell functions sourced from /etc/rc.status: |
||
47 | # rc_check check and set local and overall rc status |
||
48 | # rc_status check and set local and overall rc status |
||
49 | # rc_status -v ditto but be verbose in local rc status |
||
50 | # rc_status -v -r ditto and clear the local rc status |
||
51 | # rc_failed set local and overall rc status to failed |
||
52 | # rc_failed <num> set local and overall rc status to <num><num> |
||
53 | # rc_reset clear local rc status (overall remains) |
||
54 | # rc_exit exit appropriate to overall rc status |
||
55 | . /etc/rc.status |
||
56 | |||
57 | # First reset status of this service |
||
58 | rc_reset |
||
59 | |||
60 | # Return values acc. to LSB for all commands but status: |
||
61 | # 0 - success |
||
62 | # 1 - generic or unspecified error |
||
63 | # 2 - invalid or excess argument(s) |
||
64 | # 3 - unimplemented feature (e.g. "reload") |
||
65 | # 4 - insufficient privilege |
||
66 | # 5 - program is not installed |
||
67 | # 6 - program is not configured |
||
68 | # 7 - program is not running |
||
69 | # |
||
70 | # Note that starting an already running service, stopping |
||
71 | # or restarting a not-running service as well as the restart |
||
72 | # with force-reload (in case signalling is not supported) are |
||
73 | # considered a success. |
||
74 | |||
75 | case "$1" in |
||
76 | start) |
||
77 | echo -n "Starting Redmine daemon" |
||
78 | ## Start daemon with startproc(8). If this fails |
||
79 | ## the echo return value is set appropriate. |
||
80 | |||
81 | # NOTE: startproc return 0, even if service is |
||
82 | # already running to match LSB spec. |
||
83 | startproc -t 2 -u $REDMINE_USER -g $REDMINE_GROUP /usr/bin/ruby $REDMI-NE_BIN server webrick -e $ENVIRONMENT >$RCFILE 2>&1 |
||
84 | ps aux --columns 200 | grep $REDMINE_BIN | grep -v grep | awk '{print $2}'> $PIDFILE |
||
85 | |||
86 | # Remember status and be verbose |
||
87 | rc_status -v |
||
88 | ;; |
||
89 | stop) |
||
90 | echo -n "Shutting down Redmine daemon" |
||
91 | ## Stop daemon with killproc(8) and if this fails |
||
92 | ## set echo the echo return value. |
||
93 | |||
94 | killproc -INT -p $PIDFILE ruby $REDMINE_BIN >/dev/null 2>&1 |
||
95 | # Remember status and be verbose |
||
96 | rc_status -v |
||
97 | ;; |
||
98 | try-restart) |
||
99 | ## Stop the service and if this succeeds (i.e. the |
||
100 | ## service was running before), start it again. |
||
101 | ## Note: try-restart is not (yet) part of LSB (as of 0.7.5) |
||
102 | $0 status >/dev/null && $0 restart |
||
103 | |||
104 | # Remember status and be quiet |
||
105 | rc_status |
||
106 | ;; |
||
107 | restart) |
||
108 | ## Stop the service and regardless of whether it was |
||
109 | ## running or not, start it again. |
||
110 | $0 stop |
||
111 | $0 start |
||
112 | |||
113 | # Remember status and be quiet |
||
114 | rc_status |
||
115 | ;; |
||
116 | force-reload) |
||
117 | ## Signal the daemon to reload its config. Most daemons |
||
118 | ## do this on signal 1 (SIGHUP). |
||
119 | ## If it does not support it, restart. |
||
120 | $0 stop |
||
121 | $0 start |
||
122 | |||
123 | # Remember status and be quiet |
||
124 | rc_status |
||
125 | ;; |
||
126 | reload) |
||
127 | ## Like force-reload, but if daemon does not support |
||
128 | ## signalling, do nothing (!) |
||
129 | |||
130 | ## Otherwise if it does not support reload: |
||
131 | rc_status -v |
||
132 | ;; |
||
133 | status) |
||
134 | echo -n "Checking for Redmine: " |
||
135 | ## Check status with checkproc(8), if process is running |
||
136 | ## checkproc will return with exit status 0. |
||
137 | |||
138 | # Status has a slightly different for the status command: |
||
139 | # 0 - service running |
||
140 | # 1 - service dead, but /var/run/ pid file exists |
||
141 | # 2 - service dead, but /var/lock/ lock file exists |
||
142 | # 3 - service not running |
||
143 | |||
144 | # NOTE: checkproc returns LSB compliant status values. |
||
145 | checkproc -p $PIDFILE ruby $REDMINE_BIN |
||
146 | rc_status -v |
||
147 | ;; |
||
148 | probe) |
||
149 | ## Optional: Probe for the necessity of a reload, |
||
150 | ## give out the argument which is required for a reload. |
||
151 | |||
152 | ;; |
||
153 | *) |
||
154 | echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload|reload|probe}" |
||
155 | exit 1 |
||
156 | ;; |
||
157 | esac |
||
158 | rc_exit |
||
159 | |||
160 | </pre> |