Merge lp:~derek-name/openvista-gtm-integration/replication into lp:openvista-gtm-integration
- replication
- Merge into mainline
Proposed by
Derek_
Status: | Merged | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Approved by: | Derek_ | ||||||||||||||||
Approved revision: | 707 | ||||||||||||||||
Merged at revision: | 147 | ||||||||||||||||
Proposed branch: | lp:~derek-name/openvista-gtm-integration/replication | ||||||||||||||||
Merge into: | lp:openvista-gtm-integration | ||||||||||||||||
Diff against target: |
15331 lines (+11986/-1111) 77 files modified
.bzrignore (+2/-0) debuild.sh (+12/-0) docs/man1/openvista.1 (+5/-5) docs/man1/ovbackup.1 (+8/-6) docs/man1/ovcc.1 (+5/-5) docs/man1/ovcheckperms.1 (+5/-3) docs/man1/ovcompile.1 (+5/-5) docs/man1/ovgetvar.1 (+21/-19) docs/man1/ovimport.1 (+5/-5) docs/man1/ovpurgejournals.1 (+5/-5) docs/man1/ovswitchjournals.1 (+5/-5) docs/man1/ovtied.1 (+5/-5) docs/man8/ovgenconfig.8 (+123/-0) docs/man8/ovinstanceadd.8 (+21/-10) docs/man8/ovinstancedel.8 (+5/-5) docs/man8/ovinstancerepl.8 (+168/-0) docs/man8/ovmysqlrepl.8 (+132/-0) docs/man8/ovreplicate.8 (+149/-0) docs/man8/ovrestore.8 (+10/-5) docs/man8/ovsshkey.8 (+84/-0) packages/deb/Ubuntu/10.04/openvista-gtm-integration/debian/control (+1/-1) packages/deb/Ubuntu/10.04/openvista-gtm-integration/debian/openvista-utils.dirs (+3/-0) packages/deb/Ubuntu/10.04/openvista-gtm-integration/debian/openvista-utils.manpages (+16/-11) packages/deb/Ubuntu/10.04/openvista-gtm-integration/debian/openvista-utils.postinst (+45/-1) packages/deb/Ubuntu/10.04/openvista-gtm-integration/debian/rules (+17/-3) packages/deb/Ubuntu/10.10/openvista-gtm-integration/debian/control (+1/-1) packages/deb/Ubuntu/10.10/openvista-gtm-integration/debian/openvista-utils.dirs (+3/-0) packages/deb/Ubuntu/10.10/openvista-gtm-integration/debian/openvista-utils.manpages (+16/-11) packages/deb/Ubuntu/10.10/openvista-gtm-integration/debian/openvista-utils.postinst (+45/-1) packages/deb/Ubuntu/10.10/openvista-gtm-integration/debian/rules (+17/-3) packages/deb/Ubuntu/9.10/openvista-gtm-integration/debian/control (+1/-1) packages/deb/Ubuntu/9.10/openvista-gtm-integration/debian/openvista-utils.dirs (+3/-0) packages/deb/Ubuntu/9.10/openvista-gtm-integration/debian/openvista-utils.manpages (+16/-11) packages/deb/Ubuntu/9.10/openvista-gtm-integration/debian/openvista-utils.postinst (+45/-1) packages/deb/Ubuntu/9.10/openvista-gtm-integration/debian/rules (+17/-3) packages/rpm/CentOS/5/lsyncd.spec (+45/-0) packages/rpm/CentOS/5/openvista-gtm-integration.spec (+37/-2) packages/rpm/CentOS/5/openvista-gtm-integration_chkconfig.patch (+46/-14) rpmbuild.sh (+1/-1) scripts/etc/bash_completion.d/openvista (+516/-82) scripts/etc/init.d/openvista (+95/-95) scripts/etc/init.d/openvista-databases (+317/-132) scripts/etc/init.d/openvista-init (+171/-0) scripts/etc/init.d/openvista-replication (+850/-0) scripts/etc/munin/plugin-conf.d/openvista (+4/-0) scripts/etc/openvista/lsyncd-routines.exclude (+2/-0) scripts/etc/openvista/mysqlusers (+13/-0) scripts/etc/openvista/network-interface (+15/-0) scripts/etc/openvista/primary.d/openvista-ip (+114/-0) scripts/usr/bin/openvista (+16/-23) scripts/usr/bin/ovbackup (+34/-29) scripts/usr/bin/ovcc (+19/-23) scripts/usr/bin/ovcheckperms (+13/-19) scripts/usr/bin/ovcompile (+12/-19) scripts/usr/bin/ovgetvar (+52/-28) scripts/usr/bin/ovimport (+18/-25) scripts/usr/bin/ovpurgejournals (+13/-20) scripts/usr/bin/ovswitchjournals (+14/-21) scripts/usr/bin/ovtied (+18/-23) scripts/usr/lib/openvista/functions (+2182/-95) scripts/usr/sbin/ovaddrepl (+152/-0) scripts/usr/sbin/ovgenconfig (+180/-0) scripts/usr/sbin/ovinstanceadd (+144/-149) scripts/usr/sbin/ovinstancedel (+51/-78) scripts/usr/sbin/ovinstancerepl (+1254/-0) scripts/usr/sbin/ovmysqlrepl (+1419/-0) scripts/usr/sbin/ovreplicate (+2109/-0) scripts/usr/sbin/ovrestore (+80/-43) scripts/usr/sbin/ovsshkey (+524/-0) scripts/usr/share/munin/plugins/openvista_databases_ (+8/-18) scripts/usr/share/munin/plugins/openvista_locks_ (+12/-21) scripts/usr/share/munin/plugins/openvista_processes_ (+11/-20) scripts/usr/share/munin/plugins/openvista_repl_backlog_ (+132/-0) scripts/usr/share/munin/plugins/openvista_repl_throughput_ (+113/-0) scripts/usr/share/openvista/lsyncd.conf.xml (+36/-0) scripts/usr/share/openvista/replication.conf (+92/-0) scripts/usr/share/openvista/rsyncd.conf (+31/-0) |
||||||||||||||||
To merge this branch: | bzr merge lp:~derek-name/openvista-gtm-integration/replication | ||||||||||||||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Derek_ | Approve | ||
Review via email: mp+72461@code.launchpad.net |
Commit message
Description of the change
To post a comment you must log in.
Revision history for this message
Derek_ (derek-name) : | # |
review:
Approve
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === added file '.bzrignore' |
2 | --- .bzrignore 1970-01-01 00:00:00 +0000 |
3 | +++ .bzrignore 2011-08-22 16:52:24 +0000 |
4 | @@ -0,0 +1,2 @@ |
5 | +_diff.diff |
6 | + |
7 | |
8 | === modified file 'debuild.sh' |
9 | --- debuild.sh 2009-11-19 21:10:53 +0000 |
10 | +++ debuild.sh 2011-08-22 16:52:24 +0000 |
11 | @@ -56,6 +56,18 @@ |
12 | |
13 | ( cd "/tmp/ubuntu/${package}-$version" && debuild -r sudo ) |
14 | ;; |
15 | + lsyncd) |
16 | + # download signed upstream sources |
17 | + ( cd "/tmp/ubuntu" && wget http://archive.ubuntu.com/ubuntu/pool/universe/l/lsyncd/lsyncd_${version}-1.dsc ) |
18 | + ( cd "/tmp/ubuntu" && wget http://archive.ubuntu.com/ubuntu/pool/universe/l/lsyncd/lsyncd_${version}-1.debian.tar.gz ) |
19 | + ( cd "/tmp/ubuntu" && wget http://archive.ubuntu.com/ubuntu/pool/universe/l/lsyncd/lsyncd_${version}.orig.tar.gz ) |
20 | + |
21 | + # unpack source tarball |
22 | + ( cd "/tmp/ubuntu" && tar -xzf "/tmp/ubuntu/lsyncd_${version}.orig.tar.gz" ) |
23 | + ( cd "/tmp/ubuntu/lsyncd-$version" && tar -xzf "/tmp/ubuntu/lsyncd_${version}-1.debian.tar.gz" ) |
24 | + |
25 | + ( cd "/tmp/ubuntu/lsyncd-$version" && debuild -i -uc -us -b ) |
26 | + ;; |
27 | esac |
28 | done |
29 | |
30 | |
31 | === modified file 'docs/man1/openvista.1' |
32 | --- docs/man1/openvista.1 2010-09-23 21:43:57 +0000 |
33 | +++ docs/man1/openvista.1 2011-08-22 16:52:24 +0000 |
34 | @@ -1,4 +1,4 @@ |
35 | -.TH openvista 1 "1 Dec 2009" Linux "User Manuals" |
36 | +.TH openvista 1 "11 Oct 2010" Linux "User Manuals" |
37 | .SH NAME |
38 | openvista \- wrapper around "mumps -dir" for programmers and admins |
39 | .SH SYNOPSIS |
40 | @@ -26,11 +26,11 @@ |
41 | .IP 0 |
42 | Success |
43 | .IP 1 |
44 | -Permission denied |
45 | +Unspecified error |
46 | .IP 2 |
47 | -Invalid command syntax |
48 | -.IP 3 |
49 | -Invalid argument to option |
50 | +Invalid or excess argument(s) |
51 | +.IP 4 |
52 | +User had insufficient privilege |
53 | .SH "REPORTING BUGS" |
54 | Please report any bugs you encounter at |
55 | .PP |
56 | |
57 | === modified file 'docs/man1/ovbackup.1' |
58 | --- docs/man1/ovbackup.1 2010-09-23 21:43:57 +0000 |
59 | +++ docs/man1/ovbackup.1 2011-08-22 16:52:24 +0000 |
60 | @@ -1,9 +1,9 @@ |
61 | -.TH ovbackup 1 "10 Dec 2009" Linux "User Manuals" |
62 | +.TH ovbackup 1 "11 Oct 2010" Linux "User Manuals" |
63 | .SH NAME |
64 | ovbackup \- back up routines and globals of an OpenVista instance |
65 | .SH SYNOPSIS |
66 | .B ovbackup |
67 | -[\fB-q\fR] |
68 | +[\fB-q\fR] [\fB-o\fR] |
69 | .I instance_name |
70 | .br |
71 | .B ovbackup -h |
72 | @@ -64,6 +64,8 @@ |
73 | display version information and exit |
74 | .IP -q |
75 | quiet; suppress status messages |
76 | +.IP -o |
77 | +output the backup filename |
78 | .SH FILES |
79 | .I /opt/openvista/INSTANCE_NAME/etc/backups.conf |
80 | .RS |
81 | @@ -74,11 +76,11 @@ |
82 | .IP 0 |
83 | Success |
84 | .IP 1 |
85 | -Permission denied or other error |
86 | +Unspecified error |
87 | .IP 2 |
88 | -Invalid command syntax |
89 | -.IP 3 |
90 | -Invalid argument to option |
91 | +Invalid or excess argument(s) |
92 | +.IP 4 |
93 | +User had insufficient privilege |
94 | .SH "REPORTING BUGS" |
95 | Please report any bugs you encounter at |
96 | .PP |
97 | |
98 | === modified file 'docs/man1/ovcc.1' |
99 | --- docs/man1/ovcc.1 2010-09-23 21:43:57 +0000 |
100 | +++ docs/man1/ovcc.1 2011-08-22 16:52:24 +0000 |
101 | @@ -1,4 +1,4 @@ |
102 | -.TH ovcc 1 "1 Dec 2009" Linux "User Manuals" |
103 | +.TH ovcc 1 "11 Oct 2010" Linux "User Manuals" |
104 | .SH NAME |
105 | ovcc \- wrapper around "mumps -run ^MSCOVCI" for OpenVista Classic Component |
106 | .SH SYNOPSIS |
107 | @@ -31,11 +31,11 @@ |
108 | .IP 0 |
109 | Success |
110 | .IP 1 |
111 | -Permission denied |
112 | +Unspecified error |
113 | .IP 2 |
114 | -Invalid command syntax |
115 | -.IP 3 |
116 | -Invalid argument to option |
117 | +Invalid or excess argument(s) |
118 | +.IP 4 |
119 | +User had insufficient privilege |
120 | .SH "REPORTING BUGS" |
121 | Please report any bugs you encounter at |
122 | .PP |
123 | |
124 | === modified file 'docs/man1/ovcheckperms.1' |
125 | --- docs/man1/ovcheckperms.1 2010-09-23 21:43:57 +0000 |
126 | +++ docs/man1/ovcheckperms.1 2011-08-22 16:52:24 +0000 |
127 | @@ -1,4 +1,4 @@ |
128 | -.TH ovcheckperms 1 "11 Dec 2009" Linux "User Manuals" |
129 | +.TH ovcheckperms 1 "11 Oct 2010" Linux "User Manuals" |
130 | .SH NAME |
131 | ovcheckperms \- verify permissions |
132 | .SH SYNOPSIS |
133 | @@ -33,9 +33,11 @@ |
134 | .IP 0 |
135 | All permissions were correct |
136 | .IP 1 |
137 | -Files and/or directories with incorrect permissions were found |
138 | +Files and/or directories with incorrect permissions were found, or other error |
139 | .IP 2 |
140 | -Other error |
141 | +Invalid or excess argument(s) |
142 | +.IP 4 |
143 | +User had insufficient privilege |
144 | .SH "REPORTING BUGS" |
145 | Please report any bugs you encounter at |
146 | .PP |
147 | |
148 | === modified file 'docs/man1/ovcompile.1' |
149 | --- docs/man1/ovcompile.1 2010-09-23 21:43:57 +0000 |
150 | +++ docs/man1/ovcompile.1 2011-08-22 16:52:24 +0000 |
151 | @@ -1,4 +1,4 @@ |
152 | -.TH ovcompile 1 "9 Feb 2010" Linux "User Manuals" |
153 | +.TH ovcompile 1 "11 Oct 2010" Linux "User Manuals" |
154 | .SH NAME |
155 | ovcompile \- (re)compile routines in an OpenVista instance |
156 | .SH SYNOPSIS |
157 | @@ -31,11 +31,11 @@ |
158 | .IP 0 |
159 | Success |
160 | .IP 1 |
161 | -Permission denied |
162 | +Unspecified error |
163 | .IP 2 |
164 | -Invalid command syntax |
165 | -.IP 3 |
166 | -Invalid argument to option |
167 | +Invalid or excess argument(s) |
168 | +.IP 4 |
169 | +User had insufficient privilege |
170 | .SH "REPORTING BUGS" |
171 | Please report any bugs you encounter at |
172 | .PP |
173 | |
174 | === modified file 'docs/man1/ovgetvar.1' |
175 | --- docs/man1/ovgetvar.1 2010-09-23 21:43:57 +0000 |
176 | +++ docs/man1/ovgetvar.1 2011-08-22 16:52:24 +0000 |
177 | @@ -1,25 +1,22 @@ |
178 | -.TH ovgetvar 1 "11 Dec 2009" Linux "User Manuals" |
179 | +.TH ovgetvar 1 "11 Oct 2010" Linux "User Manuals" |
180 | .SH NAME |
181 | ovgetvar \- get GT.M environment variable |
182 | .SH SYNOPSIS |
183 | .B ovgetvar |
184 | .I instance_name |
185 | -.I gtm_dist|gtm_path|gtmroutines|gtmgbldir |
186 | +.I variable_name |
187 | .br |
188 | .B ovgetvar -h |
189 | .br |
190 | .B ovgetvar -V |
191 | .SH DESCRIPTION |
192 | -.B ovgetvar |
193 | -prints the effective values of |
194 | -.I $gtm_dist |
195 | -, |
196 | -.I $gtmroutines |
197 | -, and |
198 | -.I $gtmgbldir |
199 | -for the specified OpenVista instance. It works by calling set_gtm_env, the |
200 | -function that all of the OpenVista utilities use to set their environment, then |
201 | -printing out the value of the requested variable. |
202 | +\fBovgetvar\fR prints the effective value of \fIvariable_name\fR for the |
203 | +specified OpenVista instance, where \fIvariable_name\fR is gtm_dist, gtm_path, |
204 | +gtmroutines, gtmgbldir, gtm_repl_instance, gtm_repl_instname, or |
205 | +replication_mode. It works by calling set_gtm_env, the function that all of the |
206 | +OpenVista utilities use to set their environment, then printing out the value of |
207 | +the requested variable. For more information about these environment variables, |
208 | +see http://tinco.pair.com/bhaskar/gtm/doc/books/ao/UNIX_manual/ch03s02.html |
209 | .PP |
210 | If |
211 | .I gtm_path |
212 | @@ -29,9 +26,14 @@ |
213 | .B ovgetvar |
214 | tries to follow the symlink and prints out the real path to GT.M. |
215 | .PP |
216 | -The ZCD routine in OpenVista Server is the main user of this utility, although |
217 | -it can be used by an administrator to inspect an OpenVista instance's |
218 | -configuration. |
219 | +If |
220 | +.I gtm_repl_instname |
221 | +is requested, the replication instance name is extracted from the replication |
222 | +instance file and returned. |
223 | +.PP |
224 | +The OpenVista replication utilities and the ZCD routine in OpenVista Server are |
225 | +the main users of this utility, although it can be used by an administrator to |
226 | +inspect an OpenVista instance's configuration. |
227 | .PP |
228 | .SH OPTIONS |
229 | .IP -h |
230 | @@ -42,11 +44,11 @@ |
231 | .IP 0 |
232 | Success |
233 | .IP 1 |
234 | -Permission denied or other error |
235 | +Unspecified error |
236 | .IP 2 |
237 | -Invalid command syntax |
238 | -.IP 3 |
239 | -Invalid argument to option |
240 | +Invalid or excess argument(s) |
241 | +.IP 4 |
242 | +User had insufficient privilege |
243 | .SH "REPORTING BUGS" |
244 | Please report any bugs you encounter at |
245 | .PP |
246 | |
247 | === modified file 'docs/man1/ovimport.1' |
248 | --- docs/man1/ovimport.1 2010-09-23 21:43:57 +0000 |
249 | +++ docs/man1/ovimport.1 2011-08-22 16:52:24 +0000 |
250 | @@ -1,4 +1,4 @@ |
251 | -.TH ovimport 1 "10 Dec 2009" Linux "User Manuals" |
252 | +.TH ovimport 1 "11 Oct 2010" Linux "User Manuals" |
253 | .SH NAME |
254 | ovimport \- import routines and globals into an OpenVista instance |
255 | .SH SYNOPSIS |
256 | @@ -106,11 +106,11 @@ |
257 | .IP 0 |
258 | Success |
259 | .IP 1 |
260 | -Permission denied or other error |
261 | +Unspecified error |
262 | .IP 2 |
263 | -Invalid command syntax |
264 | -.IP 3 |
265 | -Invalid argument to option |
266 | +Invalid or excess argument(s) |
267 | +.IP 4 |
268 | +User had insufficient privilege |
269 | .SH "REPORTING BUGS" |
270 | Please report any bugs you encounter at |
271 | .PP |
272 | |
273 | === modified file 'docs/man1/ovpurgejournals.1' |
274 | --- docs/man1/ovpurgejournals.1 2010-09-23 21:43:57 +0000 |
275 | +++ docs/man1/ovpurgejournals.1 2011-08-22 16:52:24 +0000 |
276 | @@ -1,4 +1,4 @@ |
277 | -.TH ovpurgejournals 1 "1 Dec 2009" Linux "User Manuals" |
278 | +.TH ovpurgejournals 1 "11 Oct 2010" Linux "User Manuals" |
279 | .SH NAME |
280 | ovpurgejournals \- delete old journal files |
281 | .SH SYNOPSIS |
282 | @@ -47,11 +47,11 @@ |
283 | .IP 0 |
284 | Success |
285 | .IP 1 |
286 | -Permission denied or other error |
287 | +Unspecified error |
288 | .IP 2 |
289 | -Invalid command syntax |
290 | -.IP 3 |
291 | -Invalid argument to option |
292 | +Invalid or excess argument(s) |
293 | +.IP 4 |
294 | +User had insufficient privilege |
295 | .SH "REPORTING BUGS" |
296 | Please report any bugs you encounter at |
297 | .PP |
298 | |
299 | === modified file 'docs/man1/ovswitchjournals.1' |
300 | --- docs/man1/ovswitchjournals.1 2010-09-23 21:43:57 +0000 |
301 | +++ docs/man1/ovswitchjournals.1 2011-08-22 16:52:24 +0000 |
302 | @@ -1,4 +1,4 @@ |
303 | -.TH ovswitchjournals 1 "1 Dec 2009" Linux "User Manuals" |
304 | +.TH ovswitchjournals 1 "11 Oct 2010" Linux "User Manuals" |
305 | .SH NAME |
306 | ovswitchjournals \- force GT.M to switch to a new journal file |
307 | .SH SYNOPSIS |
308 | @@ -34,11 +34,11 @@ |
309 | .IP 0 |
310 | Success |
311 | .IP 1 |
312 | -Permission denied or other error |
313 | +Unspecified error |
314 | .IP 2 |
315 | -Invalid command syntax |
316 | -.IP 3 |
317 | -Invalid argument to option |
318 | +Invalid or excess argument(s) |
319 | +.IP 4 |
320 | +User had insufficient privilege |
321 | .SH "REPORTING BUGS" |
322 | Please report any bugs you encounter at |
323 | .PP |
324 | |
325 | === modified file 'docs/man1/ovtied.1' |
326 | --- docs/man1/ovtied.1 2010-09-23 21:43:57 +0000 |
327 | +++ docs/man1/ovtied.1 2011-08-22 16:52:24 +0000 |
328 | @@ -1,4 +1,4 @@ |
329 | -.TH ovtied 1 "1 Dec 2009" Linux "User Manuals" |
330 | +.TH ovtied 1 "11 Oct 2010" Linux "User Manuals" |
331 | .SH NAME |
332 | ovtied \- wrapper around "mumps -run ^ZU" for end users |
333 | .SH SYNOPSIS |
334 | @@ -29,11 +29,11 @@ |
335 | .IP 0 |
336 | Success |
337 | .IP 1 |
338 | -Permission denied |
339 | +Unspecified error |
340 | .IP 2 |
341 | -Invalid command syntax |
342 | -.IP 3 |
343 | -Invalid argument to option |
344 | +Invalid or excess argument(s) |
345 | +.IP 4 |
346 | +User had insufficient privilege |
347 | .SH "REPORTING BUGS" |
348 | Please report any bugs you encounter at |
349 | .PP |
350 | |
351 | === added file 'docs/man8/ovgenconfig.8' |
352 | --- docs/man8/ovgenconfig.8 1970-01-01 00:00:00 +0000 |
353 | +++ docs/man8/ovgenconfig.8 2011-08-22 16:52:24 +0000 |
354 | @@ -0,0 +1,123 @@ |
355 | +.TH ovgenconfig 8 "27 Oct 2010" Linux "User Manuals" |
356 | +.SH NAME |
357 | +ovgenconfig \- script for generating a new OpenVista configuration file from a |
358 | +template or setting values in an existing OpenVista configuration file |
359 | +.SH SYNOPSIS |
360 | +.B ovgenconfig |
361 | +.RB [ -e ] |
362 | +.RB [ -s |
363 | +.IR subdirectory ] |
364 | +.I instance_name |
365 | +.I conf_file |
366 | +.RI [ setting... ] |
367 | +.br |
368 | +.B ovgenconfig -h |
369 | +.br |
370 | +.B ovgenconfig -V |
371 | +.SH DESCRIPTION |
372 | +.PP |
373 | +.B ovgenconfig |
374 | +generates a configuration file for an OpenVista instance based on a template |
375 | +file. Normally, if the template file contains placeholder strings in curly |
376 | +braces, e.g. "{REPLICATION_MODE}", then a \fIsetting\fR must be given for each |
377 | +such string, otherwise the curly-brace placeholder will remain in the new file. |
378 | +If the \fB-e\fR option is used, only the settings being changed need to be |
379 | +specified. |
380 | +.PP |
381 | +.B ovgenconfig |
382 | +is intended for use by other OpenVista scripts. Generation and modification of |
383 | +OpenVista configuration files should generally be accomplished by other commands |
384 | +such as \fBovinstanceadd\fR and \fBovreplicate\fR. Otherwise, it is better to |
385 | +edit the configuration files in a text editor, where you will see the settings |
386 | +explained in comments, than to run \fBovgenconfig\fR directly. |
387 | +.PP |
388 | +Running \fBovgenconfig\fR requires the user to be root and it will return an |
389 | +error otherwise. |
390 | +.SH ARGUMENTS |
391 | +.TP |
392 | +.I instance_name |
393 | +the name of an existing OpenVista instance |
394 | +.TP |
395 | +.I conf_file |
396 | +the filename (without path) of a configuration template file in |
397 | +/usr/share/openvista/ |
398 | +.TP |
399 | +.I setting |
400 | +an assignment in the form of "PLACEHOLDER_NAME=value", where |
401 | +"{PLACEHOLDER_NAME}" is the string occuring in the template file, and "value" is |
402 | +what should replace it in the resulting file. See examples below. |
403 | +.SH OPTIONS |
404 | +.TP |
405 | +.B -e |
406 | +set values in an existing file rather than creating a new one. |
407 | +This is only supported for replication.conf. |
408 | +.TP |
409 | +.B -s |
410 | +subdirectory of the OpenVista instance directory where the new file will be |
411 | +written, "etc" by default |
412 | +.TP |
413 | +.B -h |
414 | +display help text and exit |
415 | +.TP |
416 | +.B -V |
417 | +display version information and exit |
418 | +.SH EXAMPLES |
419 | +.PP |
420 | +This command generates a new replication.conf file in the 'etc' subdirectory of |
421 | +the 'open' OpenVista instance: |
422 | +.IP |
423 | +$ ovgenconfig open replication.conf \\ |
424 | +.br |
425 | +> "REPLICATION_MODE=primary" \\ |
426 | +.br |
427 | +> "REPLICATION_IP=vm2" \\ |
428 | +.br |
429 | +> "BIND_ADDRESS=vm1" \\ |
430 | +.br |
431 | +> "OTHER_INSTANCE=open" \\ |
432 | +.br |
433 | +> "MUPIP_PORT=7301" \\ |
434 | +.br |
435 | +> "INSTSECONDARY=open_Fz5e" \\ |
436 | +.br |
437 | +> "RSYNC_PORT=7401" |
438 | +.PP |
439 | +This command uses the \fB-e\fR option to set a new value for replication_ip in |
440 | +the existing replication.conf file for the 'open' OpenVista instance: |
441 | +.IP |
442 | +$ ovgenconfig -e open replication.conf "REPLICATION_IP=vm3" |
443 | +.PP |
444 | +This command generates a new rsyncd.conf file and uses the \fB-s\fR option to |
445 | +place it in the 'replication' subdirectory of the 'open' OpenVista instance: |
446 | +.IP |
447 | +$ ovgenconfig -s replication open rsyncd.conf \\ |
448 | +.br |
449 | +> "ROOT=$root" \\ |
450 | +.br |
451 | +> "INSTANCE=$instance" \\ |
452 | +.br |
453 | +> "RSYNC_PORT=$rsync_port" \\ |
454 | +.br |
455 | +> "BIND_ADDRESS=$bind_address" \\ |
456 | +.br |
457 | +> "USER=$user" \\ |
458 | +.br |
459 | +> "DOCROOT=$docroot" \\ |
460 | +.br |
461 | +> "APACHE_USER=$apache_user" |
462 | +.SH "EXIT VALUES" |
463 | +.IP 0 |
464 | +Success |
465 | +.IP 1 |
466 | +Unspecified error |
467 | +.IP 2 |
468 | +Invalid or excess argument(s) |
469 | +.IP 4 |
470 | +User had insufficient privilege |
471 | +.SH "REPORTING BUGS" |
472 | +Please report any bugs you encounter at |
473 | +.PP |
474 | +https://bugs.launchpad.net/openvista-gtm-integration |
475 | +.SH AUTHOR |
476 | +Derek Veit <derek.veit@medsphere.com> |
477 | + |
478 | |
479 | === modified file 'docs/man8/ovinstanceadd.8' |
480 | --- docs/man8/ovinstanceadd.8 2010-09-24 18:32:54 +0000 |
481 | +++ docs/man8/ovinstanceadd.8 2011-08-22 16:52:24 +0000 |
482 | @@ -1,9 +1,10 @@ |
483 | -.TH ovinstanceadd 8 "22 Sep 2010" Linux "User Manuals" |
484 | +.TH ovinstanceadd 8 "18 Oct 2010" Linux "User Manuals" |
485 | .SH NAME |
486 | ovinstanceadd \- create a new OpenVista instance |
487 | .SH SYNOPSIS |
488 | .B ovinstanceadd |
489 | [\fB-p\fR \fIpath\fR] |
490 | +[\fB-r\fR \fIgtm_repl_instname\fR] |
491 | .I instance_name |
492 | .br |
493 | .B ovinstanceadd -h |
494 | @@ -14,10 +15,11 @@ |
495 | creates a new OpenVista instance. It ensures that the |
496 | .I openvista |
497 | tied account exists, creates the directory structure for the instance, ensures |
498 | -that permissions are set correctly, creates a global directory file and empty |
499 | -database files, creates default configuration files, generates an SSH key for |
500 | -the instance, sets up an ssh forced command to run ^ZU in the instance, and |
501 | -creates the webdav root for the instance. |
502 | +that permissions are set correctly, creates the global directory file, creates |
503 | +empty database files, creates the replication instance file, creates default |
504 | +configuration files, generates an SSH key for the instance, sets up an ssh |
505 | +forced command to run ^ZU in the instance, and creates the webdav root for the |
506 | +instance. |
507 | .PP |
508 | By default, ovinstanceadd sets up the new instance to use the latest version of |
509 | GT.M installed on the system. You can specify an alternate path to a GT.M |
510 | @@ -25,7 +27,16 @@ |
511 | 0.8.10. |
512 | .SH OPTIONS |
513 | .IP -p |
514 | -path; value of $gtm_dist for this instance |
515 | +path; value of $gtm_dist for this instance. This can be set for an older |
516 | +installed version of GT.M. |
517 | +.IP -r |
518 | +GT.M replication instance name; value to use for $gtm_repl_instname for this |
519 | +instance. This should normally be set automatically, but this option can be |
520 | +used when it is necessary to re-use a name that the other server in replication |
521 | +is already configured with. For example, if a secondary server is being |
522 | +re-created and the primary server is already configured to replicate with a |
523 | +secondary instance having the replication instance name "dev_aS12", then this |
524 | +option could be used to avoid reconfiguring the primary server. |
525 | .IP -h |
526 | display help text and exit |
527 | .IP -V |
528 | @@ -34,11 +45,11 @@ |
529 | .IP 0 |
530 | Success |
531 | .IP 1 |
532 | -Permission denied or other error |
533 | +Unspecified error |
534 | .IP 2 |
535 | -Invalid command syntax |
536 | -.IP 3 |
537 | -Invalid argument to option |
538 | +Invalid or excess argument(s) |
539 | +.IP 4 |
540 | +User had insufficient privilege |
541 | .IP 9 |
542 | Instance already exists |
543 | .SH "REPORTING BUGS" |
544 | |
545 | === modified file 'docs/man8/ovinstancedel.8' |
546 | --- docs/man8/ovinstancedel.8 2010-09-23 21:43:57 +0000 |
547 | +++ docs/man8/ovinstancedel.8 2011-08-22 16:52:24 +0000 |
548 | @@ -1,4 +1,4 @@ |
549 | -.TH ovinstancedel 8 "1 Dec 2009" Linux "User Manuals" |
550 | +.TH ovinstancedel 8 "11 Oct 2010" Linux "User Manuals" |
551 | .SH NAME |
552 | ovinstancedel \- delete an OpenVista instance |
553 | .SH SYNOPSIS |
554 | @@ -28,11 +28,11 @@ |
555 | .IP 0 |
556 | Success |
557 | .IP 1 |
558 | -Permission denied or other error |
559 | +Unspecified error |
560 | .IP 2 |
561 | -Invalid command syntax |
562 | -.IP 3 |
563 | -Invalid argument to option |
564 | +Invalid or excess argument(s) |
565 | +.IP 4 |
566 | +User had insufficient privilege |
567 | .SH "REPORTING BUGS" |
568 | Please report any bugs you encounter at |
569 | .PP |
570 | |
571 | === added file 'docs/man8/ovinstancerepl.8' |
572 | --- docs/man8/ovinstancerepl.8 1970-01-01 00:00:00 +0000 |
573 | +++ docs/man8/ovinstancerepl.8 2011-08-22 16:52:24 +0000 |
574 | @@ -0,0 +1,168 @@ |
575 | +.TH ovinstancerepl 8 "3 Dec 2010" Linux "User Manuals" |
576 | +.SH NAME |
577 | +ovinstancerepl \- script for configuring an OpenVista instance for replication. |
578 | +.SH SYNOPSIS |
579 | +.HP |
580 | +.B ovinstancerepl |
581 | +.BI "-a " primary_ip |
582 | +.BI "-b " secondary_ip |
583 | +.BI "-m " mupip_port |
584 | +.BI "-r " rsync_port |
585 | +.RB [ -w |
586 | +.IR other_instance ] |
587 | +.RB [ -f |
588 | +.IR backup_file ] |
589 | +.RB [ -i |
590 | +.IR instsecondary ] |
591 | +.RB [ -k |
592 | +.IR keys_directory ] |
593 | +.BR primary | secondary |
594 | +.I instance_name |
595 | +.PP |
596 | +.B ovinstancerepl |
597 | +.RB [ -s ] |
598 | +.BR status | list |
599 | +.I instance_name |
600 | +.PP |
601 | +.B ovinstancerepl |
602 | +.BR test | stop | start |
603 | +.I instance_name |
604 | +.PP |
605 | +.B ovinstancerepl |
606 | +.RB [ -f |
607 | +.IR backup_file ] |
608 | +.BR resync |
609 | +.I instance_name |
610 | +.PP |
611 | +.B ovinstancerepl -h |
612 | +.PP |
613 | +.B ovinstancerepl -V |
614 | +.SH DESCRIPTION |
615 | +.B ovinstancerepl |
616 | +configures a single OpenVista instance for replication, either as the primary |
617 | +(source) or as the secondary (receiver). The instance is prepared for |
618 | +replication of the GT.M globals database, the GT.M routines files, and the image |
619 | +files in the WebDAV folder. \fBovinstancerepl\fR only does a part of the work in |
620 | +setting up replication for OpenVista Server. \fBovinstancerepl\fR does not |
621 | +configure anything on the remote server, configure replication of the MySQL |
622 | +database, or manage failover or switchover. For setting up or managing |
623 | +OpenVista Server replication generally, use \fBovreplicate\fR instead. |
624 | +.PP |
625 | +.B ovinstancerepl |
626 | +requires the user to be root and it will return an error otherwise. |
627 | +.PP |
628 | +.SH ACTIONS |
629 | +.TP |
630 | +.B primary |
631 | +set up the instance for replication as the primary |
632 | +.TP |
633 | +.B secondary |
634 | +set up the instance for replication as the secondary |
635 | +.TP |
636 | +.B status |
637 | +show local replication status of the instance |
638 | +.TP |
639 | +.B list |
640 | +show the configuration parameters of the instance |
641 | +.TP |
642 | +.B test |
643 | +test replication with the remote instance |
644 | +.TP |
645 | +.B stop |
646 | +disable replication for the instance |
647 | +.TP |
648 | +.B start |
649 | +re-enable replication for the instance if it has been stopped |
650 | +.TP |
651 | +.B resync |
652 | +resync a secondary instance with its primary. This is normally necessary if the |
653 | +GT.M database on the primary has been overwritten by \fBovrestore\fR or has |
654 | +experienced recovery, e.g. following a hard shutdown and restart. |
655 | +.SH OPTIONS |
656 | +.TP |
657 | +.B -h |
658 | +display help text and exit |
659 | +.TP |
660 | +.B -V |
661 | +display version information and exit |
662 | +.TP |
663 | +.BI "-a " primary_ip |
664 | +IP address or host name of the primary server. |
665 | +.TP |
666 | +.BI "-b " secondary_ip |
667 | +IP address or host name of the secondary server |
668 | +.TP |
669 | +.BI "-f " backup_file |
670 | +for secondary, full path to a backup file of the primary instance (generated by |
671 | +ovbackup). Without this option, ovinstancerepl will automatically generate and |
672 | +retrieve a new backup of the primary. To skip using a backup altogether, use -f |
673 | +"SKIP". Skipping the backup is not recommended if the primary instance contains |
674 | +a large amount of data that is not already on the secondary. |
675 | +.TP |
676 | +.BI "-i " instsecondary |
677 | +the GT.M "replication instance name" of the remote instance. |
678 | +\fBovinstancerepl\fR will normally retrieve this value automatically, but this |
679 | +option can be used if the remote server is not currently available. |
680 | +.br |
681 | +The replication instance name is composed of the OpenVista instance name, e.g. |
682 | +"dev", plus an underscore and four random alphanumeric characters, and it is |
683 | +normally generated by \fBovinstanceadd\fR when the instance is created. A |
684 | +secondary instance has a different replication instance name than its primary. |
685 | +The value can be read using \fBovgetvar\fR. |
686 | +.TP |
687 | +.BI "-k " keys_directory |
688 | +for secondary, the directory from which to copy SSH keys and the WebDAV password |
689 | +file. ovinstancerepl will normally retrieve these from the etc subdirectory of |
690 | +the remote instance automatically, but this option can be used if the remote |
691 | +server is not currently available |
692 | +.TP |
693 | +.BI "-m " mupip_port |
694 | +port number for use by the GT.M replication daemons |
695 | +.TP |
696 | +.BI "-r " rsync_port |
697 | +port number for use by the file replication daemons |
698 | +.TP |
699 | +.B -s |
700 | +format the output for scripted use |
701 | +.TP |
702 | +.BI "-w " other_instance |
703 | +the name of the OpenVista instance being replicated to or from. The |
704 | +default is for the primary and secondary instances to have the same name. |
705 | +However, if both instances are on the same server, the primary instance and the |
706 | +secondary instance must each have a different name, so this option must be used. |
707 | +.SH "EXAMPLES" |
708 | +.PP |
709 | +This command would be run on "host1" to set up the 'open' instance for |
710 | +replication as primary with the secondary instance on "host2". Port 7301 would |
711 | +be used for replication of the GT.M database and port 7401 would be used for |
712 | +file replication: |
713 | +.IP |
714 | +$ ovinstancerepl -a host1 -b host2 -m 7301 -r 7401 primary open |
715 | +.PP |
716 | +This command will show a table describing the current state of replication for |
717 | +the instance on the local server: |
718 | +.IP |
719 | +$ ovinstancerepl status open |
720 | +.PP |
721 | +This command will stop replication processes of the 'open' instance. It will |
722 | +only stop the local, primary or secondary, side of replication: |
723 | +.IP |
724 | +$ ovinstancerepl stop open |
725 | +.SH "EXIT VALUES" |
726 | +.IP 0 |
727 | +Success |
728 | +.IP 1 |
729 | +Unspecified error. The \fBtest\fR action will return 1 if the test fails. |
730 | +.IP 2 |
731 | +Invalid or excess argument(s) |
732 | +.IP 4 |
733 | +User had insufficient privilege |
734 | +.SH "REPORTING BUGS" |
735 | +Please report any bugs you encounter at |
736 | +.PP |
737 | +https://bugs.launchpad.net/openvista-gtm-integration |
738 | +.SH AUTHOR |
739 | +Derek Veit <derek.veit@medsphere.com> |
740 | +.SH "SEE ALSO" |
741 | +.BR ovreplication (8) |
742 | +.BR ovgetvar (1) |
743 | |
744 | === added file 'docs/man8/ovmysqlrepl.8' |
745 | --- docs/man8/ovmysqlrepl.8 1970-01-01 00:00:00 +0000 |
746 | +++ docs/man8/ovmysqlrepl.8 2011-08-22 16:52:24 +0000 |
747 | @@ -0,0 +1,132 @@ |
748 | +.TH ovmysqlrepl 8 "11 Nov 2010" Linux "User Manuals" |
749 | +.SH NAME |
750 | +ovmysqlrepl \- script to set up replication of the MySQL databases for OpenVista |
751 | +.SH SYNOPSIS |
752 | +.B ovmysqlrepl |
753 | +.RB [ -q ] |
754 | +.RB [ -p |
755 | +.IR mysql_password ] |
756 | +.BI "-a " primary_ip |
757 | +.BI "-b " secondary_ip |
758 | +.B primary |
759 | +.br |
760 | +.B ovmysqlrepl |
761 | +.RB [ -fqw ] |
762 | +.RB [ -p |
763 | +.IR mysql_password ] |
764 | +.BI "-a " primary_ip |
765 | +.BI "-b " secondary_ip |
766 | +.B secondary |
767 | +.br |
768 | +.B ovmysqlrepl |
769 | +.RB [ -s ] |
770 | +.RB [ -p |
771 | +.IR mysql_password ] |
772 | +.B status |
773 | +.br |
774 | +.B ovmysqlrepl |
775 | +.RB [ -p |
776 | +.IR mysql_password ] |
777 | +.BR test | mode | ip | backlog | stop | start |
778 | +.br |
779 | +.B ovmysqlrepl -h |
780 | +.br |
781 | +.B ovmysqlrepl -V |
782 | +.SH DESCRIPTION |
783 | +.B ovmysqlrepl |
784 | +configures MySQL replication, as used for OpenVista replication, on a single |
785 | +server. To set up MySQL replication between two servers, |
786 | +.B ovmysqlrepl |
787 | +must be run first on the primary server and then on the secondary server. |
788 | +.PP |
789 | +.B ovreplicate |
790 | +calls |
791 | +.B ovmysqlrepl |
792 | +when configuring replication of OpenVista instances with a remote server, so |
793 | +when using |
794 | +.B ovreplicate |
795 | +it is \fInot\fR necessary to also run |
796 | +.B ovmysqlrepl |
797 | +manually. |
798 | +Running |
799 | +.B ovmysqlrepl |
800 | +requires the user to be root and it will return an error otherwise. |
801 | +.PP |
802 | +If the MySQL root account has a password, it must be provided with the \fB-p\fR |
803 | +option. |
804 | +.SH ACTIONS |
805 | +.TP |
806 | +.B primary |
807 | +prepare this server as the primary (i.e. master or source) in MySQL replication |
808 | +.TP |
809 | +.B secondary |
810 | +prepare this server as the secondary (i.e. slave or target) in MySQL |
811 | +replication. To do this, \fBovmysqlrepl\fR needs to call \fBmysqldump\fR on the |
812 | +primary server. It calls \fBovsshkey\fR to set up SSH key authentication for |
813 | +this, and it will require the user to enter the root password of that server |
814 | +unless the OpenVista replication SSH keys have already been configured. |
815 | +.TP |
816 | +.B status |
817 | +show information about this MySQL server and its binary log positions |
818 | +.TP |
819 | +.B list |
820 | +show the configuration parameters of MySQL replication |
821 | +.TP |
822 | +.B mode |
823 | +print the current replication mode of this MySQL server, primary or secondary |
824 | +.TP |
825 | +.B ip |
826 | +print the address of the remote server |
827 | +.TP |
828 | +.B backlog |
829 | +on the secondary: show binary log positions and backlog |
830 | +.TP |
831 | +.BR stop | start |
832 | +disable or enable replication on this server 'start' requires that replication |
833 | +has been configured using 'primary' or 'secondary' but has been stopped |
834 | +.SH OPTIONS |
835 | +.TP |
836 | +.B -h |
837 | +display help text and exit |
838 | +.TP |
839 | +.B -V |
840 | +display version information and exit |
841 | +.TP |
842 | +.BI "-a " primary_ip |
843 | +IP address or host name of the primary server. |
844 | +.TP |
845 | +.BI "-b " secondary_ip |
846 | +IP address or host name of the secondary server |
847 | +.TP |
848 | +.B -f |
849 | +drop the databases of the secondary without first prompting for confirmation. |
850 | +This is intended for use by a script, e.g. ovreplicate, which would handle the |
851 | +appropriate user confirmation separately. |
852 | +.TP |
853 | +.B -q |
854 | +minimize non-error output |
855 | +.TP |
856 | +.B -s |
857 | +format the output for scripted use |
858 | +.TP |
859 | +.B -w |
860 | +skip copying master data (for use in switchover only) |
861 | +.SH "EXIT VALUES" |
862 | +.IP 0 |
863 | +Success |
864 | +.IP 1 |
865 | +Unspecified error. The \fBtest\fR action will return 1 if the test fails. |
866 | +.IP 2 |
867 | +Invalid or excess argument(s) |
868 | +.IP 4 |
869 | +User had insufficient privilege |
870 | +.SH "REPORTING BUGS" |
871 | +Please report any bugs you encounter at |
872 | +.PP |
873 | +https://bugs.launchpad.net/openvista-gtm-integration |
874 | +.SH AUTHOR |
875 | +Derek Veit <derek.veit@medsphere.com> |
876 | +.SH "SEE ALSO" |
877 | +.BR ovreplicate (8), |
878 | +.BR ovsshkey (8) |
879 | + |
880 | |
881 | === added file 'docs/man8/ovreplicate.8' |
882 | --- docs/man8/ovreplicate.8 1970-01-01 00:00:00 +0000 |
883 | +++ docs/man8/ovreplicate.8 2011-08-22 16:52:24 +0000 |
884 | @@ -0,0 +1,149 @@ |
885 | +.TH ovreplicate 8 "19 Nov 2010" Linux "User Manuals" |
886 | +.SH NAME |
887 | +ovreplicate \- script for configuring replication of OpenVista Server. |
888 | +.SH SYNOPSIS |
889 | +.B ovreplicate |
890 | +.RB [ -e |
891 | +.IR instance_name ] |
892 | +.RB [ -p |
893 | +.IR mysql_password ] |
894 | +.BR setup | switchover | promote | demote | stop | start |
895 | +.br |
896 | +.B ovreplicate |
897 | +.RB [ -s ] |
898 | +.BR status | list |
899 | +.RI [ instance_name... ] |
900 | +.br |
901 | +.B ovreplicate |
902 | +.BR test |
903 | +.RI [ instance_name... ] |
904 | +.br |
905 | +.B ovreplicate -h |
906 | +.br |
907 | +.B ovreplicate -V |
908 | +.SH DESCRIPTION |
909 | +.B ovreplicate |
910 | +is the main user utility for configuring replication of OpenVista Server. Both |
911 | +the primary server and the secondary server can be configured at once from |
912 | +either location. Replication is configured for three types of data: the GT.M |
913 | +globals database, files (GT.M routines and also image files in the WebDAV |
914 | +folder), and the MySQL database. |
915 | +.PP |
916 | +Replication copies one or more OpenVista instances on one server, the |
917 | +primary, to instances with the same names on another server, the secondary. |
918 | +.PP |
919 | +.B ovreplicate |
920 | +requires the user to be root and it will return an error otherwise. |
921 | +.PP |
922 | +To allow configuration of the remote server, \fBovreplicate\fR calls |
923 | +\fBovsshkey\fR to set up SSH key authentication between the servers. This will |
924 | +require the user to enter the root password of that server unless the OpenVista |
925 | +replication SSH keys have already been configured. |
926 | +.SH ACTIONS |
927 | +.TP |
928 | +.B setup |
929 | +set up replication with this server as the primary |
930 | +.TP |
931 | +.B switchover |
932 | +run on the secondary, while replication is running, to swap primary and |
933 | +secondary roles. The local server will be the new primary. The |
934 | +\fBswitchover\fR option is only for a controlled switchover when both servers |
935 | +are available and replication is active and successful. Otherwise, the |
936 | +\fBsetup\fR, \fBpromote\fR, or \fBdemote\fR action may be used to reconfigure a |
937 | +server from one role to the other, but depending on circumstances, other steps |
938 | +may be necessary to ensure that data is not lost. |
939 | +.TP |
940 | +.B promote |
941 | +run on the secondary to make it the primary. The old primary must no longer be |
942 | +serving to clients. When possible, use \fBswitchover\fR instead. |
943 | +.TP |
944 | +.B demote |
945 | +run on the primary to make it the secondary. When possible, use |
946 | +\fBswitchover\fR instead. |
947 | +.TP |
948 | +.B stop |
949 | +disable OpenVista replication |
950 | +.TP |
951 | +.B start |
952 | +re-enable OpenVista replication if it has been stopped |
953 | +.TP |
954 | +.B status |
955 | +show the current configuration and status of all OpenVista replication |
956 | +components for the primary and secondary of each OpenVista instance |
957 | +.TP |
958 | +.B list |
959 | +show the configuration parameters of each local OpenVista instance |
960 | +.TP |
961 | +.B test |
962 | +test replication by writing values on the primary server and reading them on the |
963 | +secondary server |
964 | +.SH OPTIONS |
965 | +.TP |
966 | +.B -h |
967 | +display help text and exit |
968 | +.TP |
969 | +.B -V |
970 | +display version information and exit |
971 | +.TP |
972 | +.BI "-e " instance |
973 | +exclude the instance from the action. "mysql" can be specified to exclude MySQL |
974 | +from the action. Multiple names may be specified within quotes. |
975 | +.TP |
976 | +.BI "-p " mysql_password |
977 | +must be the MySQL root password if one is set |
978 | +.TP |
979 | +.B -s |
980 | +format the output for scripted use |
981 | +.SH "EXAMPLES" |
982 | +.PP |
983 | +This command would be run on an OpenVista server to set it up for replication |
984 | +with another OpenVista server. The server on which the command is run will be |
985 | +the primary and the other server will be the secondary: |
986 | +.IP |
987 | +$ ovreplicate setup |
988 | +.PP |
989 | +This would be run on a running secondary server to cause it to trade places with |
990 | +its primary, so that the secondary would become the primary and the primary |
991 | +would become the secondary: |
992 | +.IP |
993 | +$ ovreplicate switchover |
994 | +.PP |
995 | +This command will show a table describing the current state of replication, on |
996 | +both the local server and the remote server for each local OpenVista instance |
997 | +and for MySQL: |
998 | +.IP |
999 | +$ ovreplicate status |
1000 | +.PP |
1001 | +This command would be run on a secondary to stop replication on that server: |
1002 | +.IP |
1003 | +$ ovreplicate stop |
1004 | +.SH "EXIT VALUES" |
1005 | +.IP 0 |
1006 | +Success |
1007 | +.IP 1 |
1008 | +Unspecified error |
1009 | +.IP 2 |
1010 | +Invalid or excess argument(s) |
1011 | +.IP 4 |
1012 | +User had insufficient privilege |
1013 | +.PP |
1014 | +For the 'test' action, the following codes may be combined to describe the type |
1015 | +of replication that failed the test. For example, a return code of 48 would |
1016 | +indicate that file replication failed for both the GT.M routines directory and |
1017 | +the WebDAV directory: |
1018 | +.IP 8 |
1019 | +Test of GT.M globals replication failed |
1020 | +.IP 16 |
1021 | +Test of GT.M routines file replication failed |
1022 | +.IP 32 |
1023 | +Test of WebDAV file replication failed |
1024 | +.IP 64 |
1025 | +Test of MySQL replication failed |
1026 | +.SH "REPORTING BUGS" |
1027 | +Please report any bugs you encounter at |
1028 | +.PP |
1029 | +https://bugs.launchpad.net/openvista-gtm-integration |
1030 | +.SH AUTHOR |
1031 | +Derek Veit <derek.veit@medsphere.com> |
1032 | +.SH "SEE ALSO" |
1033 | +.BR ovinstancerepl (8), ovmysqlrepl (8), ovinstanceadd (8), ovinstancedel (8) |
1034 | |
1035 | === modified file 'docs/man8/ovrestore.8' |
1036 | --- docs/man8/ovrestore.8 2010-09-23 21:43:57 +0000 |
1037 | +++ docs/man8/ovrestore.8 2011-08-22 16:52:24 +0000 |
1038 | @@ -1,4 +1,4 @@ |
1039 | -.TH ovrestore 8 "10 Dec 2009" Linux "User Manuals" |
1040 | +.TH ovrestore 8 "11 Oct 2010" Linux "User Manuals" |
1041 | .SH NAME |
1042 | ovrestore \- restores a backup file into an OpenVista instance |
1043 | .SH SYNOPSIS |
1044 | @@ -61,6 +61,11 @@ |
1045 | flag can only be used when restoring a backup into the instance that originally |
1046 | created the backup. |
1047 | .PP |
1048 | +If the target instance has a replication instance file, it is re-created at the |
1049 | +end of the restore process. This resets the history of replicated transaction |
1050 | +sequence numbers; the sequence numbers in the old database likely do not match |
1051 | +the sequence numbers in the restored database. |
1052 | +.PP |
1053 | Depending on the size of the backup file and the speed of the hardware, |
1054 | .B ovrestore |
1055 | may take several hours to complete. By default, dated status messages are |
1056 | @@ -84,11 +89,11 @@ |
1057 | .IP 0 |
1058 | Success |
1059 | .IP 1 |
1060 | -Permission denied or other error |
1061 | +Unspecified error |
1062 | .IP 2 |
1063 | -Invalid command syntax |
1064 | -.IP 3 |
1065 | -Invalid argument to option |
1066 | +Invalid or excess argument(s) |
1067 | +.IP 4 |
1068 | +User had insufficient privilege |
1069 | .SH "REPORTING BUGS" |
1070 | Please report any bugs you encounter at |
1071 | .PP |
1072 | |
1073 | === added file 'docs/man8/ovsshkey.8' |
1074 | --- docs/man8/ovsshkey.8 1970-01-01 00:00:00 +0000 |
1075 | +++ docs/man8/ovsshkey.8 2011-08-22 16:52:24 +0000 |
1076 | @@ -0,0 +1,84 @@ |
1077 | +.TH ovsshkey 8 "30 Nov 2010" Linux "User Manuals" |
1078 | +.SH NAME |
1079 | +ovsshkey \- script for setting up ssh key exchange with another server |
1080 | +.SH SYNOPSIS |
1081 | +.B ovsshkey |
1082 | +.RB [ -p |
1083 | +.IR password_prompt ] |
1084 | +.RB [ -q ] |
1085 | +.RB [ -s |
1086 | +.IR instance_name ] |
1087 | +.RB [ -t ] |
1088 | +.I remote_host |
1089 | +.br |
1090 | +.B ovsshkey -h |
1091 | +.br |
1092 | +.B ovsshkey -V |
1093 | +.br |
1094 | +.B ovsshkey |
1095 | +.RB [ -k |
1096 | +.IR caller ] |
1097 | +.br |
1098 | +.B ovsshkey -n |
1099 | +.SH DESCRIPTION |
1100 | +.B ovsshkey |
1101 | +creates and copies SSH keys as necessary to establish bidirectional |
1102 | +key-authorized access between the local server and a remote server. This is |
1103 | +used by OpenVista utility scripts to coordinate replication activities. |
1104 | +.PP |
1105 | +The key names specific to OpenVista are used so as not to conflict with any |
1106 | +other key usage on the two servers. |
1107 | +.SH OPTIONS |
1108 | +.TP |
1109 | +.B -h |
1110 | +display help text and exit |
1111 | +.TP |
1112 | +.B -V |
1113 | +display version information and exit |
1114 | +.TP |
1115 | +.BI "-k " caller |
1116 | +just generate the local ssh key files. This is used by \fBovsshkey\fR when |
1117 | +calling itself on the remote server. The \fIcaller\fR argument is used by |
1118 | +\fBovsshkey\fR to log what host is calling it remotely. |
1119 | +.TP |
1120 | +.B -n |
1121 | +print the name used for the key file |
1122 | +.TP |
1123 | +.BI "-p " password_prompt |
1124 | +if the user must enter the remote root password, print \fIpassword_prompt\fR |
1125 | +just before the prompt. This will appear even if the -q option is set. |
1126 | +.TP |
1127 | +.B -q |
1128 | +quiet mode, minimize non-error output to console. When used with the -t option |
1129 | +error messages are also suppressed. |
1130 | +.TP |
1131 | +.BI "-s " instance_name |
1132 | +for setting up a secondary server for replication, copy the SSH host keys of |
1133 | +\fIremote_host\fR (the primary server) to the local host (the secondary server) |
1134 | +so that after a switchover, SSH clients will trust the former secondary server |
1135 | +as the new primary server. This can only be invoked on the secondary server. |
1136 | +\fIinstance_name\fR is used only to verify that the local host is the secondary |
1137 | +server, and it can be the name of any configured secondary OpenVista instance on |
1138 | +the server. |
1139 | +.TP |
1140 | +.B -t |
1141 | +test only, exit 0 if key exchange has already been set up with this server using |
1142 | +\fBovsshkey\fR and it is successful, otherwise exit 1. This will also output |
1143 | +success or failure messages unless the -q option is specified. |
1144 | +.SH "EXIT VALUES" |
1145 | +.IP 0 |
1146 | +Success |
1147 | +.IP 1 |
1148 | +Unspecified error |
1149 | +.IP 2 |
1150 | +Invalid or excess argument(s) |
1151 | +.IP 4 |
1152 | +User had insufficient privilege |
1153 | +.SH "REPORTING BUGS" |
1154 | +Please report any bugs you encounter at |
1155 | +.PP |
1156 | +https://bugs.launchpad.net/openvista-gtm-integration |
1157 | +.SH AUTHOR |
1158 | +Derek Veit <derek.veit@medsphere.com> |
1159 | +.SH "SEE ALSO" |
1160 | +.BR ovreplicate (8) |
1161 | |
1162 | === modified file 'packages/deb/Ubuntu/10.04/openvista-gtm-integration/debian/control' |
1163 | --- packages/deb/Ubuntu/10.04/openvista-gtm-integration/debian/control 2010-11-12 23:05:47 +0000 |
1164 | +++ packages/deb/Ubuntu/10.04/openvista-gtm-integration/debian/control 2011-08-22 16:52:24 +0000 |
1165 | @@ -8,7 +8,7 @@ |
1166 | |
1167 | Package: openvista-utils |
1168 | Architecture: any |
1169 | -Depends: ${shlibs:Depends}, ${misc:Depends}, adduser, rsync, pbzip2 (>= 1.0.5) | bzip2, cron, openssh-client, apache2.2-common, ssl-cert, openvista-libs-5.4000a | openvista-libs |
1170 | +Depends: ${shlibs:Depends}, ${misc:Depends}, adduser, rsync, pbzip2 (>= 1.0.5) | bzip2, cron, openssh-client, apache2.2-common, ssl-cert, mysql-server, openvista-libs-5.4000a | openvista-libs |
1171 | Recommends: openssh-server, apache2 |
1172 | Suggests: putty-tools, bash-completion, pbzip2 (>= 1.0.5) |
1173 | Description: Utilities for configuring and managing OpenVista |
1174 | |
1175 | === modified file 'packages/deb/Ubuntu/10.04/openvista-gtm-integration/debian/openvista-utils.dirs' |
1176 | --- packages/deb/Ubuntu/10.04/openvista-gtm-integration/debian/openvista-utils.dirs 2010-01-16 22:24:12 +0000 |
1177 | +++ packages/deb/Ubuntu/10.04/openvista-gtm-integration/debian/openvista-utils.dirs 2011-08-22 16:52:24 +0000 |
1178 | @@ -1,5 +1,8 @@ |
1179 | etc/apache2/conf.d |
1180 | etc/bash_completion.d |
1181 | +etc/openvista |
1182 | +etc/openvista/primary.d |
1183 | +etc/openvista/secondary.d |
1184 | opt/openvista |
1185 | sbin |
1186 | usr/bin |
1187 | |
1188 | === modified file 'packages/deb/Ubuntu/10.04/openvista-gtm-integration/debian/openvista-utils.manpages' |
1189 | --- packages/deb/Ubuntu/10.04/openvista-gtm-integration/debian/openvista-utils.manpages 2010-02-09 23:36:06 +0000 |
1190 | +++ packages/deb/Ubuntu/10.04/openvista-gtm-integration/debian/openvista-utils.manpages 2011-08-22 16:52:24 +0000 |
1191 | @@ -1,15 +1,20 @@ |
1192 | +docs/man1/openvista.1 |
1193 | +docs/man1/ovbackup.1 |
1194 | +docs/man1/ovcc.1 |
1195 | +docs/man1/ovcheckperms.1 |
1196 | +docs/man1/ovcompile.1 |
1197 | +docs/man1/ovgetvar.1 |
1198 | +docs/man1/ovimport.1 |
1199 | +docs/man1/ovpurgejournals.1 |
1200 | +docs/man1/ovswitchjournals.1 |
1201 | +docs/man1/ovtied.1 |
1202 | docs/man8/gtmsignal.8 |
1203 | +docs/man8/ovauth.8 |
1204 | +docs/man8/ovgenconfig.8 |
1205 | docs/man8/ovinstanceadd.8 |
1206 | docs/man8/ovinstancedel.8 |
1207 | +docs/man8/ovinstancerepl.8 |
1208 | +docs/man8/ovmysqlrepl.8 |
1209 | +docs/man8/ovreplicate.8 |
1210 | docs/man8/ovrestore.8 |
1211 | -docs/man8/ovauth.8 |
1212 | -docs/man1/openvista.1 |
1213 | -docs/man1/ovtied.1 |
1214 | -docs/man1/ovcc.1 |
1215 | -docs/man1/ovbackup.1 |
1216 | -docs/man1/ovpurgejournals.1 |
1217 | -docs/man1/ovswitchjournals.1 |
1218 | -docs/man1/ovimport.1 |
1219 | -docs/man1/ovcheckperms.1 |
1220 | -docs/man1/ovgetvar.1 |
1221 | -docs/man1/ovcompile.1 |
1222 | +docs/man8/ovsshkey.8 |
1223 | |
1224 | === modified file 'packages/deb/Ubuntu/10.04/openvista-gtm-integration/debian/openvista-utils.postinst' |
1225 | --- packages/deb/Ubuntu/10.04/openvista-gtm-integration/debian/openvista-utils.postinst 2010-01-16 22:24:12 +0000 |
1226 | +++ packages/deb/Ubuntu/10.04/openvista-gtm-integration/debian/openvista-utils.postinst 2011-08-22 16:52:24 +0000 |
1227 | @@ -1,4 +1,4 @@ |
1228 | -#!/bin/sh |
1229 | +#!/bin/bash |
1230 | # postinst script for openvista-utils |
1231 | # |
1232 | # see: dh_installdeb(1) |
1233 | @@ -55,6 +55,50 @@ |
1234 | /etc/init.d/apache2 restart |
1235 | fi |
1236 | fi |
1237 | + |
1238 | + # add replication support to existing instances if upgrading |
1239 | + if [ -n "$2" ] && dpkg --compare-versions "$2" lt 0.9-1; then |
1240 | + echo "Adding replication support to existing instances..." |
1241 | + . /usr/lib/openvista/functions |
1242 | + for instname in $(list_openvista_instances); do |
1243 | + # skip the instance if it has already been prepared for replication |
1244 | + instance=$(get_ov_root)/${instname} |
1245 | + if [ -e "${instance}/replication" ]; then |
1246 | + echo "Instance ${instname} already supports replication" |
1247 | + continue |
1248 | + fi |
1249 | + |
1250 | + # create replication directory |
1251 | + install -o root -g openvista -m 2770 -d "${instance}/replication" |
1252 | + |
1253 | + # create replication.conf |
1254 | + /usr/sbin/ovgenconfig "${instname}" "replication.conf" \ |
1255 | + "REPLICATION_MODE=" \ |
1256 | + "REPLICATION_IP=" \ |
1257 | + "BIND_ADDRESS=" \ |
1258 | + "OTHER_INSTANCE=" \ |
1259 | + "MUPIP_PORT=" \ |
1260 | + "INSTSECONDARY=" \ |
1261 | + "RSYNC_PORT=" |
1262 | + |
1263 | + # generate the replication instance name |
1264 | + random_suffix=$(tr -dc 'A-Za-z0-9' < /dev/urandom | head -c4) |
1265 | + gtm_repl_instname="${instname:0:8}_${random_suffix}" |
1266 | + |
1267 | + # create replication instance file |
1268 | + gtm_dist=${instance}/gtm gtmgbldir=${instance}/globals/mumps.gld gtm_repl_instance=${instance}/replication/repl_instance "${instance}/gtm/mupip" replicate -instance_create -name="${gtm_repl_instname}" 2>&1 \ |
1269 | + | logger -p user.info |
1270 | + chmod 660 "${instance}/replication/repl_instance" |
1271 | + |
1272 | + echo "Support for replication added to ${instname}" |
1273 | + done |
1274 | + |
1275 | + fi |
1276 | + |
1277 | + # on install or upgrade |
1278 | + if dpkg --compare-versions "$2" lt 0.9-1; then |
1279 | + ln -s /etc/rc.d/init.d/openvista /etc/openvista/primary.d/openvista |
1280 | + fi |
1281 | ;; |
1282 | |
1283 | abort-upgrade|abort-remove|abort-deconfigure) |
1284 | |
1285 | === modified file 'packages/deb/Ubuntu/10.04/openvista-gtm-integration/debian/rules' |
1286 | --- packages/deb/Ubuntu/10.04/openvista-gtm-integration/debian/rules 2010-11-12 23:05:47 +0000 |
1287 | +++ packages/deb/Ubuntu/10.04/openvista-gtm-integration/debian/rules 2011-08-22 16:52:24 +0000 |
1288 | @@ -72,7 +72,9 @@ |
1289 | |
1290 | # openvista-utils |
1291 | rm -f debian/openvista-utils.openvista-databases.init |
1292 | + rm -f debian/openvista-utils.openvista-replication.init |
1293 | rm -f debian/openvista-utils.openvista.init |
1294 | + rm -f debian/openvista-utils.openvista-init.init |
1295 | rm -f debian/openvista-utils.openvista.cron.d |
1296 | rm -f debian/openvista-utils.openvista.cron.daily |
1297 | rm -f src/ovauth/ovauth |
1298 | @@ -87,9 +89,9 @@ |
1299 | dh_installdirs -i |
1300 | |
1301 | install -m 644 scripts/etc/munin/plugin-conf.d/openvista debian/openvista-munin-plugins/etc/munin/plugin-conf.d/ |
1302 | - install scripts/usr/share/munin/plugins/openvista_databases_ debian/openvista-munin-plugins/usr/share/munin/plugins/ |
1303 | - install scripts/usr/share/munin/plugins/openvista_locks_ debian/openvista-munin-plugins/usr/share/munin/plugins/ |
1304 | - install scripts/usr/share/munin/plugins/openvista_processes_ debian/openvista-munin-plugins/usr/share/munin/plugins/ |
1305 | + for plugin in scripts/usr/share/munin/plugins/*; do \ |
1306 | + install $$plugin debian/openvista-munin-plugins/usr/share/munin/plugins/ ;\ |
1307 | + done |
1308 | |
1309 | dh_install -i |
1310 | |
1311 | @@ -122,14 +124,24 @@ |
1312 | install $$script debian/openvista-utils/usr/bin/ ;\ |
1313 | done |
1314 | |
1315 | + for script in scripts/etc/openvista/primary.d/*; do \ |
1316 | + install $$script debian/openvista-utils/etc/openvista/primary.d/ ;\ |
1317 | + done |
1318 | + |
1319 | install scripts/etc/init.d/openvista-databases debian/openvista-utils.openvista-databases.init |
1320 | + install scripts/etc/init.d/openvista-replication debian/openvista-utils.openvista-replication.init |
1321 | install scripts/etc/init.d/openvista debian/openvista-utils.openvista.init |
1322 | + install scripts/etc/init.d/openvista-init debian/openvista-utils.openvista-init.init |
1323 | |
1324 | install -m 644 scripts/etc/bash_completion.d/openvista debian/openvista-utils/etc/bash_completion.d/ |
1325 | |
1326 | install scripts/etc/cron.d/openvista debian/openvista-utils.openvista.cron.d |
1327 | install scripts/etc/cron.daily/openvista debian/openvista-utils.openvista.cron.daily |
1328 | |
1329 | + install -m 644 scripts/etc/openvista/lsyncd-routines.exclude debian/openvista-utils/etc/openvista/ |
1330 | + install -m 644 scripts/etc/openvista/mysqlusers debian/openvista-utils/etc/openvista/ |
1331 | + install -m 644 scripts/etc/openvista/network-interface debian/openvista-utils/etc/openvista/ |
1332 | + |
1333 | install -m 644 debian/webdav.conf debian/openvista-utils/etc/apache2/conf.d/ |
1334 | |
1335 | touch debian/openvista-utils/etc/apache2/webdav.htpasswd |
1336 | @@ -154,7 +166,9 @@ |
1337 | # dh_installmime |
1338 | # dh_python |
1339 | dh_installinit -r --no-start --name=openvista-databases -- defaults 28 10 |
1340 | + dh_installinit -r --no-start --name=openvista-replication -- defaults 29 11 |
1341 | dh_installinit -r --no-start --name=openvista -- defaults 98 01 |
1342 | + dh_installinit -r --no-start --name=openvista-init -- defaults 98 01 |
1343 | dh_installcron --name=openvista |
1344 | # dh_installinfo |
1345 | dh_installman |
1346 | |
1347 | === modified file 'packages/deb/Ubuntu/10.10/openvista-gtm-integration/debian/control' |
1348 | --- packages/deb/Ubuntu/10.10/openvista-gtm-integration/debian/control 2010-11-12 23:05:47 +0000 |
1349 | +++ packages/deb/Ubuntu/10.10/openvista-gtm-integration/debian/control 2011-08-22 16:52:24 +0000 |
1350 | @@ -8,7 +8,7 @@ |
1351 | |
1352 | Package: openvista-utils |
1353 | Architecture: any |
1354 | -Depends: ${shlibs:Depends}, ${misc:Depends}, adduser, rsync, pbzip2 (>= 1.0.5) | bzip2, cron, openssh-client, apache2.2-common, ssl-cert, openvista-libs-5.4000a | openvista-libs |
1355 | +Depends: ${shlibs:Depends}, ${misc:Depends}, adduser, rsync, pbzip2 (>= 1.0.5) | bzip2, cron, openssh-client, apache2.2-common, ssl-cert, mysql-server, openvista-libs-5.4000a | openvista-libs |
1356 | Recommends: openssh-server, apache2 |
1357 | Suggests: putty-tools, bash-completion, pbzip2 (>= 1.0.5) |
1358 | Description: Utilities for configuring and managing OpenVista |
1359 | |
1360 | === modified file 'packages/deb/Ubuntu/10.10/openvista-gtm-integration/debian/openvista-utils.dirs' |
1361 | --- packages/deb/Ubuntu/10.10/openvista-gtm-integration/debian/openvista-utils.dirs 2010-09-23 17:53:44 +0000 |
1362 | +++ packages/deb/Ubuntu/10.10/openvista-gtm-integration/debian/openvista-utils.dirs 2011-08-22 16:52:24 +0000 |
1363 | @@ -1,5 +1,8 @@ |
1364 | etc/apache2/conf.d |
1365 | etc/bash_completion.d |
1366 | +etc/openvista |
1367 | +etc/openvista/primary.d |
1368 | +etc/openvista/secondary.d |
1369 | opt/openvista |
1370 | sbin |
1371 | usr/bin |
1372 | |
1373 | === modified file 'packages/deb/Ubuntu/10.10/openvista-gtm-integration/debian/openvista-utils.manpages' |
1374 | --- packages/deb/Ubuntu/10.10/openvista-gtm-integration/debian/openvista-utils.manpages 2010-09-23 17:53:44 +0000 |
1375 | +++ packages/deb/Ubuntu/10.10/openvista-gtm-integration/debian/openvista-utils.manpages 2011-08-22 16:52:24 +0000 |
1376 | @@ -1,15 +1,20 @@ |
1377 | +docs/man1/openvista.1 |
1378 | +docs/man1/ovbackup.1 |
1379 | +docs/man1/ovcc.1 |
1380 | +docs/man1/ovcheckperms.1 |
1381 | +docs/man1/ovcompile.1 |
1382 | +docs/man1/ovgetvar.1 |
1383 | +docs/man1/ovimport.1 |
1384 | +docs/man1/ovpurgejournals.1 |
1385 | +docs/man1/ovswitchjournals.1 |
1386 | +docs/man1/ovtied.1 |
1387 | docs/man8/gtmsignal.8 |
1388 | +docs/man8/ovauth.8 |
1389 | +docs/man8/ovgenconfig.8 |
1390 | docs/man8/ovinstanceadd.8 |
1391 | docs/man8/ovinstancedel.8 |
1392 | +docs/man8/ovinstancerepl.8 |
1393 | +docs/man8/ovmysqlrepl.8 |
1394 | +docs/man8/ovreplicate.8 |
1395 | docs/man8/ovrestore.8 |
1396 | -docs/man8/ovauth.8 |
1397 | -docs/man1/openvista.1 |
1398 | -docs/man1/ovtied.1 |
1399 | -docs/man1/ovcc.1 |
1400 | -docs/man1/ovbackup.1 |
1401 | -docs/man1/ovpurgejournals.1 |
1402 | -docs/man1/ovswitchjournals.1 |
1403 | -docs/man1/ovimport.1 |
1404 | -docs/man1/ovcheckperms.1 |
1405 | -docs/man1/ovgetvar.1 |
1406 | -docs/man1/ovcompile.1 |
1407 | +docs/man8/ovsshkey.8 |
1408 | |
1409 | === modified file 'packages/deb/Ubuntu/10.10/openvista-gtm-integration/debian/openvista-utils.postinst' |
1410 | --- packages/deb/Ubuntu/10.10/openvista-gtm-integration/debian/openvista-utils.postinst 2010-09-23 17:53:44 +0000 |
1411 | +++ packages/deb/Ubuntu/10.10/openvista-gtm-integration/debian/openvista-utils.postinst 2011-08-22 16:52:24 +0000 |
1412 | @@ -1,4 +1,4 @@ |
1413 | -#!/bin/sh |
1414 | +#!/bin/bash |
1415 | # postinst script for openvista-utils |
1416 | # |
1417 | # see: dh_installdeb(1) |
1418 | @@ -55,6 +55,50 @@ |
1419 | /etc/init.d/apache2 restart |
1420 | fi |
1421 | fi |
1422 | + |
1423 | + # add replication support to existing instances if upgrading |
1424 | + if [ -n "$2" ] && dpkg --compare-versions "$2" lt 0.9-1; then |
1425 | + echo "Adding replication support to existing instances..." |
1426 | + . /usr/lib/openvista/functions |
1427 | + for instname in $(list_openvista_instances); do |
1428 | + # skip the instance if it has already been prepared for replication |
1429 | + instance=$(get_ov_root)/${instname} |
1430 | + if [ -e "${instance}/replication" ]; then |
1431 | + echo "Instance ${instname} already supports replication" |
1432 | + continue |
1433 | + fi |
1434 | + |
1435 | + # create replication directory |
1436 | + install -o root -g openvista -m 2770 -d "${instance}/replication" |
1437 | + |
1438 | + # create replication.conf |
1439 | + /usr/sbin/ovgenconfig "${instname}" "replication.conf" \ |
1440 | + "REPLICATION_MODE=" \ |
1441 | + "REPLICATION_IP=" \ |
1442 | + "BIND_ADDRESS=" \ |
1443 | + "OTHER_INSTANCE=" \ |
1444 | + "MUPIP_PORT=" \ |
1445 | + "INSTSECONDARY=" \ |
1446 | + "RSYNC_PORT=" |
1447 | + |
1448 | + # generate the replication instance name |
1449 | + random_suffix=$(tr -dc 'A-Za-z0-9' < /dev/urandom | head -c4) |
1450 | + gtm_repl_instname="${instname:0:8}_${random_suffix}" |
1451 | + |
1452 | + # create replication instance file |
1453 | + gtm_dist=${instance}/gtm gtmgbldir=${instance}/globals/mumps.gld gtm_repl_instance=${instance}/replication/repl_instance "${instance}/gtm/mupip" replicate -instance_create -name="${gtm_repl_instname}" 2>&1 \ |
1454 | + | logger -p user.info |
1455 | + chmod 660 "${instance}/replication/repl_instance" |
1456 | + |
1457 | + echo "Support for replication added to ${instname}" |
1458 | + done |
1459 | + |
1460 | + fi |
1461 | + |
1462 | + # on install or upgrade |
1463 | + if dpkg --compare-versions "$2" lt 0.9-1; then |
1464 | + ln -s /etc/rc.d/init.d/openvista /etc/openvista/primary.d/openvista |
1465 | + fi |
1466 | ;; |
1467 | |
1468 | abort-upgrade|abort-remove|abort-deconfigure) |
1469 | |
1470 | === modified file 'packages/deb/Ubuntu/10.10/openvista-gtm-integration/debian/rules' |
1471 | --- packages/deb/Ubuntu/10.10/openvista-gtm-integration/debian/rules 2010-11-12 23:05:47 +0000 |
1472 | +++ packages/deb/Ubuntu/10.10/openvista-gtm-integration/debian/rules 2011-08-22 16:52:24 +0000 |
1473 | @@ -72,7 +72,9 @@ |
1474 | |
1475 | # openvista-utils |
1476 | rm -f debian/openvista-utils.openvista-databases.init |
1477 | + rm -f debian/openvista-utils.openvista-replication.init |
1478 | rm -f debian/openvista-utils.openvista.init |
1479 | + rm -f debian/openvista-utils.openvista-init.init |
1480 | rm -f debian/openvista-utils.openvista.cron.d |
1481 | rm -f debian/openvista-utils.openvista.cron.daily |
1482 | rm -f src/ovauth/ovauth |
1483 | @@ -87,9 +89,9 @@ |
1484 | dh_installdirs -i |
1485 | |
1486 | install -m 644 scripts/etc/munin/plugin-conf.d/openvista debian/openvista-munin-plugins/etc/munin/plugin-conf.d/ |
1487 | - install scripts/usr/share/munin/plugins/openvista_databases_ debian/openvista-munin-plugins/usr/share/munin/plugins/ |
1488 | - install scripts/usr/share/munin/plugins/openvista_locks_ debian/openvista-munin-plugins/usr/share/munin/plugins/ |
1489 | - install scripts/usr/share/munin/plugins/openvista_processes_ debian/openvista-munin-plugins/usr/share/munin/plugins/ |
1490 | + for plugin in scripts/usr/share/munin/plugins/*; do \ |
1491 | + install $$plugin debian/openvista-munin-plugins/usr/share/munin/plugins/ ;\ |
1492 | + done |
1493 | |
1494 | dh_install -i |
1495 | |
1496 | @@ -122,14 +124,24 @@ |
1497 | install $$script debian/openvista-utils/usr/bin/ ;\ |
1498 | done |
1499 | |
1500 | + for script in scripts/etc/openvista/primary.d/*; do \ |
1501 | + install $$script debian/openvista-utils/etc/openvista/primary.d/ ;\ |
1502 | + done |
1503 | + |
1504 | install scripts/etc/init.d/openvista-databases debian/openvista-utils.openvista-databases.init |
1505 | + install scripts/etc/init.d/openvista-replication debian/openvista-utils.openvista-replication.init |
1506 | install scripts/etc/init.d/openvista debian/openvista-utils.openvista.init |
1507 | + install scripts/etc/init.d/openvista-init debian/openvista-utils.openvista-init.init |
1508 | |
1509 | install -m 644 scripts/etc/bash_completion.d/openvista debian/openvista-utils/etc/bash_completion.d/ |
1510 | |
1511 | install scripts/etc/cron.d/openvista debian/openvista-utils.openvista.cron.d |
1512 | install scripts/etc/cron.daily/openvista debian/openvista-utils.openvista.cron.daily |
1513 | |
1514 | + install -m 644 scripts/etc/openvista/lsyncd-routines.exclude debian/openvista-utils/etc/openvista/ |
1515 | + install -m 644 scripts/etc/openvista/mysqlusers debian/openvista-utils/etc/openvista/ |
1516 | + install -m 644 scripts/etc/openvista/network-interface debian/openvista-utils/etc/openvista/ |
1517 | + |
1518 | install -m 644 debian/webdav.conf debian/openvista-utils/etc/apache2/conf.d/ |
1519 | |
1520 | touch debian/openvista-utils/etc/apache2/webdav.htpasswd |
1521 | @@ -154,7 +166,9 @@ |
1522 | # dh_installmime |
1523 | # dh_python |
1524 | dh_installinit -r --no-start --name=openvista-databases -- defaults 28 10 |
1525 | + dh_installinit -r --no-start --name=openvista-replication -- defaults 29 11 |
1526 | dh_installinit -r --no-start --name=openvista -- defaults 98 01 |
1527 | + dh_installinit -r --no-start --name=openvista-init -- defaults 98 01 |
1528 | dh_installcron --name=openvista |
1529 | # dh_installinfo |
1530 | dh_installman |
1531 | |
1532 | === modified file 'packages/deb/Ubuntu/9.10/openvista-gtm-integration/debian/control' |
1533 | --- packages/deb/Ubuntu/9.10/openvista-gtm-integration/debian/control 2010-11-12 23:05:47 +0000 |
1534 | +++ packages/deb/Ubuntu/9.10/openvista-gtm-integration/debian/control 2011-08-22 16:52:24 +0000 |
1535 | @@ -8,7 +8,7 @@ |
1536 | |
1537 | Package: openvista-utils |
1538 | Architecture: any |
1539 | -Depends: ${shlibs:Depends}, ${misc:Depends}, adduser, rsync, pbzip2 (>= 1.0.5) | bzip2, cron, openssh-client, apache2.2-common, ssl-cert, openvista-libs-5.4000a | openvista-libs |
1540 | +Depends: ${shlibs:Depends}, ${misc:Depends}, adduser, rsync, pbzip2 (>= 1.0.5) | bzip2, cron, openssh-client, apache2.2-common, ssl-cert, mysql-server, openvista-libs-5.4000a | openvista-libs |
1541 | Recommends: openssh-server, apache2 |
1542 | Suggests: putty-tools, bash-completion, pbzip2 (>= 1.0.5) |
1543 | Description: Utilities for configuring and managing OpenVista |
1544 | |
1545 | === modified file 'packages/deb/Ubuntu/9.10/openvista-gtm-integration/debian/openvista-utils.dirs' |
1546 | --- packages/deb/Ubuntu/9.10/openvista-gtm-integration/debian/openvista-utils.dirs 2009-12-17 00:39:25 +0000 |
1547 | +++ packages/deb/Ubuntu/9.10/openvista-gtm-integration/debian/openvista-utils.dirs 2011-08-22 16:52:24 +0000 |
1548 | @@ -1,5 +1,8 @@ |
1549 | etc/apache2/conf.d |
1550 | etc/bash_completion.d |
1551 | +etc/openvista |
1552 | +etc/openvista/primary.d |
1553 | +etc/openvista/secondary.d |
1554 | opt/openvista |
1555 | sbin |
1556 | usr/bin |
1557 | |
1558 | === modified file 'packages/deb/Ubuntu/9.10/openvista-gtm-integration/debian/openvista-utils.manpages' |
1559 | --- packages/deb/Ubuntu/9.10/openvista-gtm-integration/debian/openvista-utils.manpages 2010-02-09 23:36:06 +0000 |
1560 | +++ packages/deb/Ubuntu/9.10/openvista-gtm-integration/debian/openvista-utils.manpages 2011-08-22 16:52:24 +0000 |
1561 | @@ -1,15 +1,20 @@ |
1562 | +docs/man1/openvista.1 |
1563 | +docs/man1/ovbackup.1 |
1564 | +docs/man1/ovcc.1 |
1565 | +docs/man1/ovcheckperms.1 |
1566 | +docs/man1/ovcompile.1 |
1567 | +docs/man1/ovgetvar.1 |
1568 | +docs/man1/ovimport.1 |
1569 | +docs/man1/ovpurgejournals.1 |
1570 | +docs/man1/ovswitchjournals.1 |
1571 | +docs/man1/ovtied.1 |
1572 | docs/man8/gtmsignal.8 |
1573 | +docs/man8/ovauth.8 |
1574 | +docs/man8/ovgenconfig.8 |
1575 | docs/man8/ovinstanceadd.8 |
1576 | docs/man8/ovinstancedel.8 |
1577 | +docs/man8/ovinstancerepl.8 |
1578 | +docs/man8/ovmysqlrepl.8 |
1579 | +docs/man8/ovreplicate.8 |
1580 | docs/man8/ovrestore.8 |
1581 | -docs/man8/ovauth.8 |
1582 | -docs/man1/openvista.1 |
1583 | -docs/man1/ovtied.1 |
1584 | -docs/man1/ovcc.1 |
1585 | -docs/man1/ovbackup.1 |
1586 | -docs/man1/ovpurgejournals.1 |
1587 | -docs/man1/ovswitchjournals.1 |
1588 | -docs/man1/ovimport.1 |
1589 | -docs/man1/ovcheckperms.1 |
1590 | -docs/man1/ovgetvar.1 |
1591 | -docs/man1/ovcompile.1 |
1592 | +docs/man8/ovsshkey.8 |
1593 | |
1594 | === modified file 'packages/deb/Ubuntu/9.10/openvista-gtm-integration/debian/openvista-utils.postinst' |
1595 | --- packages/deb/Ubuntu/9.10/openvista-gtm-integration/debian/openvista-utils.postinst 2009-11-19 21:19:51 +0000 |
1596 | +++ packages/deb/Ubuntu/9.10/openvista-gtm-integration/debian/openvista-utils.postinst 2011-08-22 16:52:24 +0000 |
1597 | @@ -1,4 +1,4 @@ |
1598 | -#!/bin/sh |
1599 | +#!/bin/bash |
1600 | # postinst script for openvista-utils |
1601 | # |
1602 | # see: dh_installdeb(1) |
1603 | @@ -55,6 +55,50 @@ |
1604 | /etc/init.d/apache2 restart |
1605 | fi |
1606 | fi |
1607 | + |
1608 | + # add replication support to existing instances if upgrading |
1609 | + if [ -n "$2" ] && dpkg --compare-versions "$2" lt 0.9-1; then |
1610 | + echo "Adding replication support to existing instances..." |
1611 | + . /usr/lib/openvista/functions |
1612 | + for instname in $(list_openvista_instances); do |
1613 | + # skip the instance if it has already been prepared for replication |
1614 | + instance=$(get_ov_root)/${instname} |
1615 | + if [ -e "${instance}/replication" ]; then |
1616 | + echo "Instance ${instname} already supports replication" |
1617 | + continue |
1618 | + fi |
1619 | + |
1620 | + # create replication directory |
1621 | + install -o root -g openvista -m 2770 -d "${instance}/replication" |
1622 | + |
1623 | + # create replication.conf |
1624 | + /usr/sbin/ovgenconfig "${instname}" "replication.conf" \ |
1625 | + "REPLICATION_MODE=" \ |
1626 | + "REPLICATION_IP=" \ |
1627 | + "BIND_ADDRESS=" \ |
1628 | + "OTHER_INSTANCE=" \ |
1629 | + "MUPIP_PORT=" \ |
1630 | + "INSTSECONDARY=" \ |
1631 | + "RSYNC_PORT=" |
1632 | + |
1633 | + # generate the replication instance name |
1634 | + random_suffix=$(tr -dc 'A-Za-z0-9' < /dev/urandom | head -c4) |
1635 | + gtm_repl_instname="${instname:0:8}_${random_suffix}" |
1636 | + |
1637 | + # create replication instance file |
1638 | + gtm_dist=${instance}/gtm gtmgbldir=${instance}/globals/mumps.gld gtm_repl_instance=${instance}/replication/repl_instance "${instance}/gtm/mupip" replicate -instance_create -name="${gtm_repl_instname}" 2>&1 \ |
1639 | + | logger -p user.info |
1640 | + chmod 660 "${instance}/replication/repl_instance" |
1641 | + |
1642 | + echo "Support for replication added to ${instname}" |
1643 | + done |
1644 | + |
1645 | + fi |
1646 | + |
1647 | + # on install or upgrade |
1648 | + if dpkg --compare-versions "$2" lt 0.9-1; then |
1649 | + ln -s /etc/rc.d/init.d/openvista /etc/openvista/primary.d/openvista |
1650 | + fi |
1651 | ;; |
1652 | |
1653 | abort-upgrade|abort-remove|abort-deconfigure) |
1654 | |
1655 | === modified file 'packages/deb/Ubuntu/9.10/openvista-gtm-integration/debian/rules' |
1656 | --- packages/deb/Ubuntu/9.10/openvista-gtm-integration/debian/rules 2010-11-12 23:05:47 +0000 |
1657 | +++ packages/deb/Ubuntu/9.10/openvista-gtm-integration/debian/rules 2011-08-22 16:52:24 +0000 |
1658 | @@ -72,7 +72,9 @@ |
1659 | |
1660 | # openvista-utils |
1661 | rm -f debian/openvista-utils.openvista-databases.init |
1662 | + rm -f debian/openvista-utils.openvista-replication.init |
1663 | rm -f debian/openvista-utils.openvista.init |
1664 | + rm -f debian/openvista-utils.openvista-init.init |
1665 | rm -f debian/openvista-utils.openvista.cron.d |
1666 | rm -f debian/openvista-utils.openvista.cron.daily |
1667 | rm -f src/ovauth/ovauth |
1668 | @@ -87,9 +89,9 @@ |
1669 | dh_installdirs -i |
1670 | |
1671 | install -m 644 scripts/etc/munin/plugin-conf.d/openvista debian/openvista-munin-plugins/etc/munin/plugin-conf.d/ |
1672 | - install scripts/usr/share/munin/plugins/openvista_databases_ debian/openvista-munin-plugins/usr/share/munin/plugins/ |
1673 | - install scripts/usr/share/munin/plugins/openvista_locks_ debian/openvista-munin-plugins/usr/share/munin/plugins/ |
1674 | - install scripts/usr/share/munin/plugins/openvista_processes_ debian/openvista-munin-plugins/usr/share/munin/plugins/ |
1675 | + for plugin in scripts/usr/share/munin/plugins/*; do \ |
1676 | + install $$plugin debian/openvista-munin-plugins/usr/share/munin/plugins/ ;\ |
1677 | + done |
1678 | |
1679 | dh_install -i |
1680 | |
1681 | @@ -122,14 +124,24 @@ |
1682 | install $$script debian/openvista-utils/usr/bin/ ;\ |
1683 | done |
1684 | |
1685 | + for script in scripts/etc/openvista/primary.d/*; do \ |
1686 | + install $$script debian/openvista-utils/etc/openvista/primary.d/ ;\ |
1687 | + done |
1688 | + |
1689 | install scripts/etc/init.d/openvista-databases debian/openvista-utils.openvista-databases.init |
1690 | + install scripts/etc/init.d/openvista-replication debian/openvista-utils.openvista-replication.init |
1691 | install scripts/etc/init.d/openvista debian/openvista-utils.openvista.init |
1692 | + install scripts/etc/init.d/openvista-init debian/openvista-utils.openvista-init.init |
1693 | |
1694 | install -m 644 scripts/etc/bash_completion.d/openvista debian/openvista-utils/etc/bash_completion.d/ |
1695 | |
1696 | install scripts/etc/cron.d/openvista debian/openvista-utils.openvista.cron.d |
1697 | install scripts/etc/cron.daily/openvista debian/openvista-utils.openvista.cron.daily |
1698 | |
1699 | + install -m 644 scripts/etc/openvista/lsyncd-routines.exclude debian/openvista-utils/etc/openvista/ |
1700 | + install -m 644 scripts/etc/openvista/mysqlusers debian/openvista-utils/etc/openvista/ |
1701 | + install -m 644 scripts/etc/openvista/network-interface debian/openvista-utils/etc/openvista/ |
1702 | + |
1703 | install -m 644 debian/webdav.conf debian/openvista-utils/etc/apache2/conf.d/ |
1704 | |
1705 | touch debian/openvista-utils/etc/apache2/webdav.htpasswd |
1706 | @@ -154,7 +166,9 @@ |
1707 | # dh_installmime |
1708 | # dh_python |
1709 | dh_installinit -r --no-start --name=openvista-databases -- defaults 28 10 |
1710 | + dh_installinit -r --no-start --name=openvista-replication -- defaults 29 11 |
1711 | dh_installinit -r --no-start --name=openvista -- defaults 98 01 |
1712 | + dh_installinit -r --no-start --name=openvista-init -- defaults 98 01 |
1713 | dh_installcron --name=openvista |
1714 | # dh_installinfo |
1715 | dh_installman |
1716 | |
1717 | === added file 'packages/rpm/CentOS/5/lsyncd.spec' |
1718 | --- packages/rpm/CentOS/5/lsyncd.spec 1970-01-01 00:00:00 +0000 |
1719 | +++ packages/rpm/CentOS/5/lsyncd.spec 2011-08-22 16:52:24 +0000 |
1720 | @@ -0,0 +1,45 @@ |
1721 | +Name: lsyncd |
1722 | +Version: 1.34 |
1723 | +Release: 1 |
1724 | +Summary: Live Syncing Daemon |
1725 | +License: GPLv2+ |
1726 | +URL: http://code.google.com/p/lsyncd/ |
1727 | +Group: Applications/Internet |
1728 | +Packager: Jonathan Tai <jon.tai@medsphere.com> |
1729 | + |
1730 | +Source: lsyncd-%{version}.tar.gz |
1731 | +BuildRoot: %{_tmppath}/%{name}-root |
1732 | + |
1733 | +Requires: /usr/bin/rsync, libxml2 |
1734 | +BuildRequires: libxml2-devel |
1735 | + |
1736 | +%description |
1737 | +Lsyncd uses rsync to synchronize local directories with a remote machine |
1738 | +running rsyncd. Lsyncd watches multiple directories trees through inotify. The |
1739 | +first step after adding the watches is to rsync all directories with the remote |
1740 | +host, and then sync single file by collecting the inotify events. So lsyncd is |
1741 | +a light-weight live mirror solution that should be easy to install and use |
1742 | +while blending well with your system. See lsyncd --help for detailed command |
1743 | +line options. |
1744 | + |
1745 | +%prep |
1746 | +%setup |
1747 | + |
1748 | +%build |
1749 | +./configure --prefix=/usr |
1750 | +make |
1751 | + |
1752 | +%install |
1753 | +rm -rf %{buildroot} |
1754 | + |
1755 | +make DESTDIR=%{buildroot} install |
1756 | + |
1757 | +%clean |
1758 | +rm -rf %{buildroot} |
1759 | + |
1760 | +%files |
1761 | +%defattr(-,root,root) |
1762 | +%doc AUTHORS ChangeLog COPYING INSTALL NEWS README TODO |
1763 | +%doc %{_mandir}/man1/lsyncd.1* |
1764 | +%doc %{_mandir}/man5/lsyncd.conf.xml.5* |
1765 | +%{_bindir}/lsyncd |
1766 | |
1767 | === modified file 'packages/rpm/CentOS/5/openvista-gtm-integration.spec' |
1768 | --- packages/rpm/CentOS/5/openvista-gtm-integration.spec 2010-12-07 00:31:07 +0000 |
1769 | +++ packages/rpm/CentOS/5/openvista-gtm-integration.spec 2011-08-22 16:52:24 +0000 |
1770 | @@ -7,7 +7,7 @@ |
1771 | %endif |
1772 | |
1773 | Name: openvista-gtm-integration |
1774 | -Version: 0.8.11 |
1775 | +Version: 0.9 |
1776 | Release: 1 |
1777 | Summary: Utilities for configuring and managing OpenVista |
1778 | License: AGPL |
1779 | @@ -94,11 +94,24 @@ |
1780 | |
1781 | install -d %{buildroot}%{_sysconfdir}/rc.d/init.d/ |
1782 | install scripts/etc/init.d/openvista-databases %{buildroot}%{_sysconfdir}/rc.d/init.d/ |
1783 | +install scripts/etc/init.d/openvista-replication %{buildroot}%{_sysconfdir}/rc.d/init.d/ |
1784 | install scripts/etc/init.d/openvista %{buildroot}%{_sysconfdir}/rc.d/init.d/ |
1785 | +install scripts/etc/init.d/openvista-init %{buildroot}%{_sysconfdir}/rc.d/init.d/ |
1786 | |
1787 | install -d %{buildroot}%{_sysconfdir}/bash_completion.d/ |
1788 | install -m 644 scripts/etc/bash_completion.d/openvista %{buildroot}%{_sysconfdir}/bash_completion.d/ |
1789 | |
1790 | +install -d %{buildroot}%{_sysconfdir}/openvista/ |
1791 | +install -m 644 scripts/etc/openvista/lsyncd-routines.exclude %{buildroot}%{_sysconfdir}/openvista/ |
1792 | +install -m 644 scripts/etc/openvista/mysqlusers %{buildroot}%{_sysconfdir}/openvista/ |
1793 | +install -m 644 scripts/etc/openvista/network-interface %{buildroot}%{_sysconfdir}/openvista/ |
1794 | + |
1795 | +install -d %{buildroot}%{_sysconfdir}/openvista/primary.d/ |
1796 | +for script in scripts/etc/openvista/primary.d/*; do |
1797 | + install $script %{buildroot}%{_sysconfdir}/openvista/primary.d/ |
1798 | +done |
1799 | +install -d %{buildroot}%{_sysconfdir}/openvista/secondary.d |
1800 | + |
1801 | install -d %{buildroot}%{_sysconfdir}/cron.d/ |
1802 | install -m 644 scripts/etc/cron.d/openvista %{buildroot}%{_sysconfdir}/cron.d/ |
1803 | |
1804 | @@ -434,6 +447,7 @@ |
1805 | Requires: /bin/bash, coreutils, openssh, /usr/bin/logger, /usr/bin/rsync, /bin/tar, /usr/bin/bzip2, /usr/bin/find, vixie-cron |
1806 | Requires: openvista-libs |
1807 | Requires: httpd, mod_ssl, pam |
1808 | +Requires: lsyncd, mysql-server |
1809 | BuildRequires: pam-devel |
1810 | |
1811 | # RPM should have a suggests tag... |
1812 | @@ -462,8 +476,15 @@ |
1813 | %{_mandir}/man8/* |
1814 | %{_mandir}/man1/* |
1815 | %{_sysconfdir}/rc.d/init.d/openvista-databases |
1816 | +%{_sysconfdir}/rc.d/init.d/openvista-replication |
1817 | %{_sysconfdir}/rc.d/init.d/openvista |
1818 | +%{_sysconfdir}/rc.d/init.d/openvista-init |
1819 | %{_sysconfdir}/bash_completion.d/openvista |
1820 | +%{_sysconfdir}/openvista/lsyncd-routines.exclude |
1821 | +%{_sysconfdir}/openvista/mysqlusers |
1822 | +%{_sysconfdir}/openvista/network-interface |
1823 | +%{_sysconfdir}/openvista/primary.d |
1824 | +%{_sysconfdir}/openvista/secondary.d |
1825 | %config(noreplace) %{_sysconfdir}/cron.d/openvista |
1826 | %{_sysconfdir}/cron.daily/openvista |
1827 | %attr(2750,root,openvista) %dir /opt/openvista |
1828 | @@ -478,7 +499,7 @@ |
1829 | /usr/sbin/useradd -g openvista -G gtm openvista 2> /dev/null || : |
1830 | |
1831 | # update lock space in existing databases if upgrading |
1832 | -%triggerun -n openvista-utils -- openvista-utils <= 0.8.3-2 |
1833 | +%triggerun -n openvista-utils -- openvista-utils < 0.8.3-3 |
1834 | echo "Increasing lock space of existing databases..." |
1835 | for instance in /opt/openvista/*; do |
1836 | # update global directory |
1837 | @@ -510,10 +531,21 @@ |
1838 | fi |
1839 | done |
1840 | |
1841 | +# add replication support to existing instances if upgrading |
1842 | +%triggerun -n openvista-utils -- openvista-utils < 0.9 |
1843 | +# add replication support to existing instances |
1844 | +/usr/sbin/ovaddrepl || : |
1845 | + |
1846 | +ln -s /etc/rc.d/init.d/openvista /etc/openvista/primary.d/openvista || : |
1847 | + |
1848 | %post -n openvista-utils |
1849 | if [ $1 = 1 ]; then |
1850 | /sbin/chkconfig --add openvista-databases |
1851 | + /sbin/chkconfig --add openvista-replication |
1852 | /sbin/chkconfig --add openvista |
1853 | + /sbin/chkconfig --add openvista-init |
1854 | + |
1855 | + ln -s /etc/rc.d/init.d/openvista /etc/openvista/primary.d/openvista |
1856 | fi |
1857 | |
1858 | /sbin/service httpd reload > /dev/null 2>&1 || : |
1859 | @@ -521,7 +553,10 @@ |
1860 | %preun -n openvista-utils |
1861 | if [ $1 = 0 ]; then |
1862 | /sbin/chkconfig --del openvista-databases |
1863 | + /sbin/chkconfig --del openvista-replication |
1864 | /sbin/chkconfig --del openvista |
1865 | + /sbin/chkconfig --del openvista-init |
1866 | + rm -f /etc/openvista/primary.d/openvista |
1867 | fi |
1868 | |
1869 | %postun -n openvista-utils |
1870 | |
1871 | === modified file 'packages/rpm/CentOS/5/openvista-gtm-integration_chkconfig.patch' |
1872 | --- packages/rpm/CentOS/5/openvista-gtm-integration_chkconfig.patch 2010-04-01 03:46:21 +0000 |
1873 | +++ packages/rpm/CentOS/5/openvista-gtm-integration_chkconfig.patch 2011-08-22 16:52:24 +0000 |
1874 | @@ -1,28 +1,26 @@ |
1875 | ---- scripts/etc/init.d/openvista 2010-03-31 20:13:12.465666412 -0700 |
1876 | -+++ scripts/etc/init.d/openvista.new 2010-03-31 20:43:59.215582465 -0700 |
1877 | -@@ -19,15 +19,6 @@ |
1878 | - # |
1879 | +--- scripts/etc/init.d/openvista 2010-12-20 11:39:45.000000000 -0800 |
1880 | ++++ scripts/etc/init.d/openvista.new 2010-12-22 18:08:40.000000000 -0800 |
1881 | +@@ -20,14 +20,6 @@ |
1882 | # chkconfig: - 98 01 |
1883 | # description: Application-level startup/shutdown script for OpenVista Server |
1884 | --# |
1885 | + # |
1886 | -### BEGIN INIT INFO |
1887 | -# Provides: openvista |
1888 | --# Required-Start: $all openvista-databases |
1889 | --# Required-Stop: $all openvista-databases |
1890 | +-# Required-Start: $all openvista-databases openvista-replication |
1891 | +-# Required-Stop: $all openvista-databases openvista-replication |
1892 | -# Default-Start: 2 3 4 5 |
1893 | -# Default-Stop: 0 1 6 |
1894 | -# Short-Description: Application-level startup/shutdown script for OpenVista Server |
1895 | -### END INIT INFO |
1896 | |
1897 | |
1898 | - # Copyright (C) 2009 Medsphere Systems Corporation |
1899 | ---- scripts/etc/init.d/openvista-databases 2010-03-31 20:13:18.255601866 -0700 |
1900 | -+++ scripts/etc/init.d/openvista-databases.new 2010-03-31 20:43:47.785582841 -0700 |
1901 | -@@ -26,15 +26,6 @@ |
1902 | - # |
1903 | + # Copyright (C) 2009-2010 Medsphere Systems Corporation |
1904 | +--- scripts/etc/init.d/openvista-databases 2010-12-21 21:28:59.000000000 -0800 |
1905 | ++++ scripts/etc/init.d/openvista-databases.new 2010-12-22 17:34:15.000000000 -0800 |
1906 | +@@ -27,14 +27,6 @@ |
1907 | # chkconfig: - 50 30 |
1908 | # description: Database-level startup/shutdown script for OpenVista Server |
1909 | --# |
1910 | + # |
1911 | -### BEGIN INIT INFO |
1912 | -# Provides: openvista-databases |
1913 | -# Required-Start: $local_fs $syslog $time |
1914 | @@ -33,4 +31,38 @@ |
1915 | -### END INIT INFO |
1916 | |
1917 | |
1918 | - # Copyright (C) 2009 Medsphere Systems Corporation |
1919 | + # Copyright (C) 2009-2010 Medsphere Systems Corporation |
1920 | +--- scripts/etc/init.d/openvista-replication 2010-12-21 15:10:16.000000000 -0800 |
1921 | ++++ scripts/etc/init.d/openvista-replication.new 2010-12-22 17:34:31.000000000 -0800 |
1922 | +@@ -5,14 +5,6 @@ |
1923 | + # chkconfig: - 56 31 |
1924 | + # description: Replication startup/shutdown script for OpenVista Server |
1925 | + # |
1926 | +-### BEGIN INIT INFO |
1927 | +-# Provides: openvista-replication |
1928 | +-# Required-Start: openvista-databases sshd |
1929 | +-# Required-Stop: |
1930 | +-# Default-Start: 2 3 4 5 |
1931 | +-# Default-Stop: 0 1 6 |
1932 | +-# Short-Description: Replication startup/shutdown script for OpenVista Server |
1933 | +-### END INIT INFO |
1934 | + |
1935 | + |
1936 | + # Copyright (C) 2010 Medsphere Systems Corporation |
1937 | +--- scripts/etc/init.d/openvista-init 2010-12-19 21:34:22.000000000 -0800 |
1938 | ++++ scripts/etc/init.d/openvista-init.new 2010-12-22 18:06:15.000000000 -0800 |
1939 | +@@ -5,14 +5,6 @@ |
1940 | + # chkconfig: - 98 01 |
1941 | + # description: Replication startup/shutdown script for OpenVista Server |
1942 | + # |
1943 | +-### BEGIN INIT INFO |
1944 | +-# Provides: openvista-init |
1945 | +-# Required-Start: openvista-databases openvista-replication |
1946 | +-# Required-Stop: openvista-databases openvista-replication |
1947 | +-# Default-Start: 2 3 4 5 |
1948 | +-# Default-Stop: 0 1 6 |
1949 | +-# Short-Description: Replication startup/shutdown script for OpenVista Server |
1950 | +-### END INIT INFO |
1951 | + |
1952 | + |
1953 | + # Copyright (C) 2010 Medsphere Systems Corporation |
1954 | |
1955 | === modified file 'rpmbuild.sh' |
1956 | --- rpmbuild.sh 2009-11-23 21:23:06 +0000 |
1957 | +++ rpmbuild.sh 2011-08-22 16:52:24 +0000 |
1958 | @@ -62,7 +62,7 @@ |
1959 | # this package must be built as root; assume sudo does not require a password |
1960 | ( cd "$topdir/SPECS" && sudo rpmbuild -ba "$package.spec" ) |
1961 | ;; |
1962 | - putty-tools) |
1963 | + putty-tools|lsyncd) |
1964 | # assume sources are already present |
1965 | |
1966 | ( cd "$topdir/SPECS" && rpmbuild -ba "$package.spec" ) |
1967 | |
1968 | === modified file 'scripts/etc/bash_completion.d/openvista' |
1969 | --- scripts/etc/bash_completion.d/openvista 2010-09-24 19:19:29 +0000 |
1970 | +++ scripts/etc/bash_completion.d/openvista 2011-08-22 16:52:24 +0000 |
1971 | @@ -4,48 +4,50 @@ |
1972 | # Copyright (C) 2009-2010 Medsphere Systems Corporation |
1973 | # |
1974 | # This program is free software; you can redistribute it and/or modify it solely |
1975 | -# under the terms of the GNU Affero General Public License version 3 as published |
1976 | -# by the Free Software Foundation. |
1977 | +# under the terms of the GNU Affero General Public License version 3 as |
1978 | +# published by the Free Software Foundation. |
1979 | # |
1980 | # This program is distributed in the hope that it will be useful, but WITHOUT |
1981 | -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
1982 | -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License |
1983 | -# for more details. |
1984 | +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
1985 | +# FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more |
1986 | +# details. |
1987 | # |
1988 | -# You should have received a copy of the GNU Affero General Public License |
1989 | -# along with this program. If not, see <http://www.gnu.org/licenses>. |
1990 | +# You should have received a copy of the GNU Affero General Public License along |
1991 | +# with this program. If not, see <http://www.gnu.org/licenses>. |
1992 | # |
1993 | # You can contact Medsphere Systems Corporation headquarters at 1917 Palomar |
1994 | # Oaks Way, Suite 200, Carlsbad, CA 92008 or at legal@medsphere.com. |
1995 | |
1996 | +# Setting extglob enables several extended pattern matching operators, including |
1997 | +# @(pattern-list), which is used by _valid_actions(). See Pathname Expansion in |
1998 | +# the bash man page for more details. |
1999 | +shopt -s extglob |
2000 | |
2001 | # common functions |
2002 | . /usr/lib/openvista/functions |
2003 | |
2004 | _ov() |
2005 | { |
2006 | + |
2007 | COMPREPLY=() |
2008 | |
2009 | - for i in `seq $COMP_CWORD`; do |
2010 | - # we've run out of the allowed number of non-option arguments; perform |
2011 | - # no further completion |
2012 | - if [ $allowed_nonopt_words -eq 0 ]; then |
2013 | - return |
2014 | - fi |
2015 | + for i in $(seq $COMP_CWORD); do |
2016 | + # we've run out of the allowed number of non-option arguments; |
2017 | + # perform no further completion |
2018 | + [[ "$allowed_nonopt_words" == 0 ]] && return |
2019 | |
2020 | case ${COMP_WORDS[i]} in |
2021 | + -*h*|-*V*) |
2022 | + # perform no further completion |
2023 | + # If we just return here, -h won't complete the space afterward. |
2024 | + allowed_nonopt_words=0 |
2025 | + ;; |
2026 | -*) |
2027 | - # if one of the arguments so far is -h or -V, perform no further completion |
2028 | - if [ x"${COMP_WORDS[i]}" = x"-h" ] || [ x"${COMP_WORDS[i]}" = x"-V" ]; then |
2029 | - # if we just return here, -h won't complete the space |
2030 | - # afterward; use a hack to exit on the next iteration of |
2031 | - # the loop |
2032 | - allowed_nonopt_words=0 |
2033 | - fi |
2034 | + # any other option |
2035 | + : |
2036 | ;; |
2037 | - |
2038 | *) |
2039 | - allowed_nonopt_words=`expr $allowed_nonopt_words - 1` |
2040 | + allowed_nonopt_words=$(( $allowed_nonopt_words - 1 )) |
2041 | ;; |
2042 | esac |
2043 | done |
2044 | @@ -57,8 +59,9 @@ |
2045 | COMPREPLY=( $(compgen -W "$opts" -- $cur) ) |
2046 | ;; |
2047 | *) |
2048 | - if [ $allowed_nonopt_words -eq 0 ]; then |
2049 | - COMPREPLY=( $(compgen -W "$(list_openvista_instances)" -- $cur) ) |
2050 | + if [[ "$allowed_nonopt_words" == 0 ]]; then |
2051 | + COMPREPLY=( \ |
2052 | + $(compgen -W "$(list_openvista_instances)" -- $cur) ) |
2053 | else |
2054 | _filedir |
2055 | fi |
2056 | @@ -82,10 +85,10 @@ |
2057 | complete -F _openvista ovcheckperms |
2058 | complete -F _openvista ovcompile |
2059 | |
2060 | -# ovbackup [-h] [-V] [-q] INSTANCE_NAME |
2061 | +# ovbackup [-h] [-V] [-q] [-o] INSTANCE_NAME |
2062 | _ovbackup() |
2063 | { |
2064 | - opts='-h -V -q' |
2065 | + opts='-h -V -q -o' |
2066 | allowed_nonopt_words=1 |
2067 | _ov |
2068 | } |
2069 | @@ -112,10 +115,10 @@ |
2070 | |
2071 | complete -F _ovrestore $filenames ovrestore |
2072 | |
2073 | -# ovinstanceadd [-h] [-V] [-p path] NEW_INSTANCE_NAME |
2074 | +# ovinstanceadd [-h] [-V] [-p PATH] [-r GTM_REPL_INSTNAME] NEW_INSTANCE_NAME |
2075 | _ovinstanceadd() |
2076 | { |
2077 | - opts='-h -V -p' |
2078 | + opts='-h -V -p -r' |
2079 | allowed_nonopt_words=1 |
2080 | |
2081 | COMPREPLY=() |
2082 | @@ -123,13 +126,14 @@ |
2083 | for i in $(seq $COMP_CWORD); do |
2084 | [[ "$allowed_nonopt_words" == 0 ]] && return |
2085 | case ${COMP_WORDS[i]} in |
2086 | + -*h*|-*V*) |
2087 | + allowed_nonopt_words=0 |
2088 | + ;; |
2089 | + -*p|-*r) |
2090 | + allowed_nonopt_words=$(( $allowed_nonopt_words + 1 )) |
2091 | + ;; |
2092 | -*) |
2093 | - if [[ "${COMP_WORDS[i]}" == "-h" ]] \ |
2094 | - || [[ "${COMP_WORDS[i]}" == "-V" ]]; then |
2095 | - allowed_nonopt_words=0 |
2096 | - elif [[ "${COMP_WORDS[i]}" == "-p" ]]; then |
2097 | - allowed_nonopt_words=$(( $allowed_nonopt_words + 1 )) |
2098 | - fi |
2099 | + : |
2100 | ;; |
2101 | *) |
2102 | allowed_nonopt_words=$(( $allowed_nonopt_words - 1 )) |
2103 | @@ -145,16 +149,16 @@ |
2104 | COMPREPLY=( $(compgen -W "$opts" -- $cur) ) |
2105 | ;; |
2106 | *) |
2107 | - if [[ "$prev" == "-p" ]]; then |
2108 | - _filedir |
2109 | - fi |
2110 | + [[ "$prev" == "-p" ]] && _filedir |
2111 | + # There is no useful way to complete gtm_repl_instname. |
2112 | ;; |
2113 | esac |
2114 | } |
2115 | |
2116 | complete -F _ovinstanceadd $filenames ovinstanceadd |
2117 | |
2118 | -# ovimport [-h] [-V] [-q] [-f] [-t target] [-c imported|all|none] [-r] ROUTINES [-g] GLOBALS INSTANCE_NAME |
2119 | +# ovimport [-h] [-V] [-q] [-f] [-t target] [-c imported|all|none] |
2120 | +# [-r] ROUTINES [-g] GLOBALS INSTANCE_NAME |
2121 | _ovimport() |
2122 | { |
2123 | opts='-h -V -q -f -t -c -r -g' |
2124 | @@ -162,28 +166,24 @@ |
2125 | |
2126 | COMPREPLY=() |
2127 | |
2128 | - for i in `seq $COMP_CWORD`; do |
2129 | - # we've run out of the allowed number of non-option arguments; perform |
2130 | - # no further completion |
2131 | - if [ $allowed_nonopt_words -eq 0 ]; then |
2132 | - return |
2133 | - fi |
2134 | + for i in $(seq $COMP_CWORD); do |
2135 | + # we've run out of the allowed number of non-option arguments; |
2136 | + # perform no further completion |
2137 | + [[ "$allowed_nonopt_words" == 0 ]] && return |
2138 | |
2139 | case ${COMP_WORDS[i]} in |
2140 | + -*h*|-*V*) |
2141 | + # perform no further completion |
2142 | + allowed_nonopt_words=0 |
2143 | + ;; |
2144 | + -*t|-*c|-*r|-*g) |
2145 | + allowed_nonopt_words=$(( $allowed_nonopt_words + 1 )) |
2146 | + ;; |
2147 | -*) |
2148 | - # if one of the arguments so far is -h or -V, perform no further completion |
2149 | - if [ x"${COMP_WORDS[i]}" = x"-h" ] || [ x"${COMP_WORDS[i]}" = x"-V" ]; then |
2150 | - # if we just return here, -h won't complete the space |
2151 | - # afterward; use a hack to exit on the next iteration of |
2152 | - # the loop |
2153 | - allowed_nonopt_words=0 |
2154 | - elif [ x"${COMP_WORDS[i]}" = x"-t" ] || [ x"${COMP_WORDS[i]}" = x"-c" ] || [ x"${COMP_WORDS[i]}" = x"-r" ] || [ x"${COMP_WORDS[i]}" = x"-g" ]; then |
2155 | - allowed_nonopt_words=`expr $allowed_nonopt_words + 1` |
2156 | - fi |
2157 | + : |
2158 | ;; |
2159 | - |
2160 | *) |
2161 | - allowed_nonopt_words=`expr $allowed_nonopt_words - 1` |
2162 | + allowed_nonopt_words=$(( $allowed_nonopt_words - 1 )) |
2163 | ;; |
2164 | esac |
2165 | done |
2166 | @@ -196,14 +196,21 @@ |
2167 | COMPREPLY=( $(compgen -W "$opts" -- $cur) ) |
2168 | ;; |
2169 | *) |
2170 | - if [ $allowed_nonopt_words -eq 0 ]; then |
2171 | - COMPREPLY=( $(compgen -W "$(list_openvista_instances)" -- $cur) ) |
2172 | - elif [ x"$prev" = x"-t" ]; then |
2173 | - _filedir -d |
2174 | - elif [ x"$prev" = x"-c" ]; then |
2175 | - COMPREPLY=( $(compgen -W "imported all none" -- $cur) ) |
2176 | - elif [ x"$prev" = x"-r" ] || [ x"$prev" = x"-g" ]; then |
2177 | - _filedir |
2178 | + if [[ "$allowed_nonopt_words" == 0 ]]; then |
2179 | + COMPREPLY=( \ |
2180 | + $(compgen -W "$(list_openvista_instances)" -- $cur) ) |
2181 | + else |
2182 | + case $prev in |
2183 | + -*t) |
2184 | + _filedir -d |
2185 | + ;; |
2186 | + -*c) |
2187 | + COMPREPLY=( $(compgen -W "imported all none" -- $cur) ) |
2188 | + ;; |
2189 | + -*r|-*g) |
2190 | + _filedir |
2191 | + ;; |
2192 | + esac |
2193 | fi |
2194 | ;; |
2195 | esac |
2196 | @@ -211,34 +218,31 @@ |
2197 | |
2198 | complete -F _ovimport $filenames ovimport |
2199 | |
2200 | -# ovgetvar [-h] [-V] INSTANCE_NAME gtm_dist|gtm_path|gtmroutines|gtmgbldir |
2201 | +# ovgetvar [-h] [-V] INSTANCE_NAME VARIABLE_NAME |
2202 | _ovgetvar() |
2203 | { |
2204 | opts='-h -V' |
2205 | allowed_nonopt_words=2 |
2206 | + variable_names="gtm_dist gtm_path gtmroutines gtmgbldir" |
2207 | + variable_names+=" gtm_repl_instance gtm_repl_instname replication_mode" |
2208 | |
2209 | COMPREPLY=() |
2210 | |
2211 | - for i in `seq $COMP_CWORD`; do |
2212 | - # we've run out of the allowed number of non-option arguments; perform |
2213 | - # no further completion |
2214 | - if [ $allowed_nonopt_words -eq 0 ]; then |
2215 | - return |
2216 | - fi |
2217 | + for i in $(seq $COMP_CWORD); do |
2218 | + # we've run out of the allowed number of non-option arguments; |
2219 | + # perform no further completion |
2220 | + [[ "$allowed_nonopt_words" == 0 ]] && return |
2221 | |
2222 | case ${COMP_WORDS[i]} in |
2223 | + -*h*|-*V*) |
2224 | + # perform no further completion |
2225 | + allowed_nonopt_words=0 |
2226 | + ;; |
2227 | -*) |
2228 | - # if one of the arguments so far is -h or -V, perform no further completion |
2229 | - if [ x"${COMP_WORDS[i]}" = x"-h" ] || [ x"${COMP_WORDS[i]}" = x"-V" ]; then |
2230 | - # if we just return here, -h won't complete the space |
2231 | - # afterward; use a hack to exit on the next iteration of |
2232 | - # the loop |
2233 | - allowed_nonopt_words=0 |
2234 | - fi |
2235 | + : |
2236 | ;; |
2237 | - |
2238 | *) |
2239 | - allowed_nonopt_words=`expr $allowed_nonopt_words - 1` |
2240 | + allowed_nonopt_words=$(( $allowed_nonopt_words - 1 )) |
2241 | ;; |
2242 | esac |
2243 | done |
2244 | @@ -250,13 +254,443 @@ |
2245 | COMPREPLY=( $(compgen -W "$opts" -- $cur) ) |
2246 | ;; |
2247 | *) |
2248 | - if [ $allowed_nonopt_words -eq 0 ]; then |
2249 | - COMPREPLY=( $(compgen -W "gtm_dist gtm_path gtmroutines gtmgbldir" -- $cur) ) |
2250 | + if [[ "$allowed_nonopt_words" == 0 ]]; then |
2251 | + COMPREPLY=( $(compgen -W "$variable_names" -- $cur) ) |
2252 | else |
2253 | - COMPREPLY=( $(compgen -W "$(list_openvista_instances)" -- $cur) ) |
2254 | + COMPREPLY=( \ |
2255 | + $(compgen -W "$(list_openvista_instances)" -- $cur) ) |
2256 | fi |
2257 | ;; |
2258 | esac |
2259 | } |
2260 | |
2261 | complete -F _ovgetvar ovgetvar |
2262 | + |
2263 | +# ovinstancerepl -a PRIMARY_IP -b SECONDARY_IP -m MUPIP_PORT -r RSYNC_PORT |
2264 | +# [-w OTHER_INSTANCE] [-f BACKUP_FILE] [-i INSTSECONDARY] |
2265 | +# [-k KEYS_DIRECTORY] primary|secondary INSTANCE_NAME |
2266 | +# or ovinstancerepl [-s] status|list INSTANCE_NAME |
2267 | +# or ovinstancerepl test|stop|start INSTANCE_NAME |
2268 | +# or ovinstancerepl [-f BACKUP_FILE] resync INSTANCE_NAME |
2269 | +# or ovinstancerepl -h |
2270 | +# or ovinstancerepl -V |
2271 | +_ovinstancerepl() |
2272 | +{ |
2273 | + local opts='-h -V -a -b -f -i -k -m -r -s -w ' |
2274 | + typeset -i allowed_nonopt_words=2 |
2275 | + |
2276 | + COMPREPLY=() |
2277 | + |
2278 | + for i in $(seq $COMP_CWORD); do |
2279 | + # we've run out of the allowed number of non-option arguments; |
2280 | + # perform no further completion |
2281 | + (( $allowed_nonopt_words == 0 )) && return |
2282 | + |
2283 | + case ${COMP_WORDS[i]} in |
2284 | + -*h*|-*V*) |
2285 | + # perform no further completion |
2286 | + allowed_nonopt_words=0 |
2287 | + ;; |
2288 | + -*a|-*b|-*m|-*r|-*w|-*f|-*i|-*k) |
2289 | + (( allowed_nonopt_words++ )) |
2290 | + ;; |
2291 | + -*) |
2292 | + : |
2293 | + ;; |
2294 | + *) |
2295 | + (( allowed_nonopt_words-- )) |
2296 | + ;; |
2297 | + esac |
2298 | + done |
2299 | + |
2300 | + local cur=${COMP_WORDS[COMP_CWORD]} |
2301 | + local prev=${COMP_WORDS[COMP_CWORD-1]} |
2302 | + |
2303 | + case $cur in |
2304 | + -*) |
2305 | + COMPREPLY=( $(compgen -W "$opts" -- $cur) ) |
2306 | + ;; |
2307 | + *) |
2308 | + case $prev in |
2309 | + -*a|-*b) |
2310 | + _known_hosts_real -a "$cur" |
2311 | + ;; |
2312 | + -*f) |
2313 | + _filedir |
2314 | + ;; |
2315 | + -*i|-*m|-*r) |
2316 | + # no useful completion |
2317 | + : |
2318 | + ;; |
2319 | + -*k) |
2320 | + _filedir -d |
2321 | + ;; |
2322 | + -*w) |
2323 | + local other_instances |
2324 | + other_instances=$(_list_other_instances) |
2325 | + [[ "$other_instances" ]] \ |
2326 | + || other_instances=$(list_openvista_instances) |
2327 | + COMPREPLY=( \ |
2328 | + $(compgen -W "$other_instances" -- $cur) ) |
2329 | + ;; |
2330 | + *) |
2331 | + if (( $allowed_nonopt_words == 0 )); then |
2332 | + # In all cases, an instance name is the last argument. |
2333 | + COMPREPLY=( \ |
2334 | + $(compgen -W "$(list_openvista_instances)" -- $cur) ) |
2335 | + else |
2336 | + actions=$(_valid_actions \ |
2337 | + "primary|secondary=a b m r|w f i k" \ |
2338 | + "status|list=|s" \ |
2339 | + "test|stop|start=" \ |
2340 | + "resync=|f" \ |
2341 | + ) |
2342 | + COMPREPLY=( $(compgen -W "${actions[*]}" -- $cur) ) |
2343 | + fi |
2344 | + ;; |
2345 | + esac |
2346 | + ;; |
2347 | + esac |
2348 | +} |
2349 | + |
2350 | +complete -F _ovinstancerepl ovinstancerepl |
2351 | + |
2352 | +_list_other_instances() |
2353 | +{ |
2354 | + # List the instances on the other server (if possible). |
2355 | + local a_flag_i primary_ip b_flag_i secondary_ip |
2356 | + if a_flag_i=$(array_index_re "-[a-z]*a" "${COMP_WORDS[@]}") \ |
2357 | + && primary_ip=${COMP_WORDS[a_flag_i+1]} \ |
2358 | + && ! is_local_ip "$primary_ip" ; then |
2359 | + replication_ip=$primary_ip |
2360 | + elif b_flag_i=$(array_index_re "-[a-z]*b" "${COMP_WORDS[@]}") \ |
2361 | + && secondary_ip=${COMP_WORDS[b_flag_i+1]} \ |
2362 | + && ! is_local_ip "$secondary_ip" ; then |
2363 | + replication_ip=$secondary_ip |
2364 | + else |
2365 | + return 1 |
2366 | + fi |
2367 | + /usr/sbin/ovsshkey -qt "$replication_ip" || return 1 |
2368 | + sshk -d "$replication_ip" \ |
2369 | + ". /usr/lib/openvista/functions; list_openvista_instances" |
2370 | +} |
2371 | + |
2372 | +_valid_actions() |
2373 | +{ |
2374 | + # Return the actions that are valid, based on options used so far. |
2375 | + # Usage: |
2376 | + # _valid_actions \ |
2377 | + # ACTION[|ACTION...]=REQD_FLAGS[|OPT_FLAGS] |
2378 | + # See _ovinstancerepl() for example. |
2379 | + local rules=( "$@" ) |
2380 | + local used_flags rule actions rule all_flags req_flags action |
2381 | + used_flags=$(printf "%s\n" "${COMP_WORDS[@]}" \ |
2382 | + | sed -nr "s/^-(.)$/\1/p" \ |
2383 | + | tr '\n' ' ') |
2384 | + for rule in "${rules[@]}"; do |
2385 | + actions=${rule%%=*} |
2386 | + all_flags=${rule#*=} |
2387 | + req_flags=${all_flags%%|*} |
2388 | + for action in ${actions//|/ }; do |
2389 | + # all req_flags must be in used_flags |
2390 | + used_flags=${used_flags// /|} |
2391 | + [[ "${req_flags//@($used_flags| )}" ]] && continue |
2392 | + # all used_flags must be in all_flags |
2393 | + all_flags=${all_flags// /|} |
2394 | + [[ "${used_flags//@($all_flags| )}" ]] && continue |
2395 | + echo -n "$action " |
2396 | + done |
2397 | + done |
2398 | +} |
2399 | + |
2400 | +# ovmysqlrepl [-q] [-p MYSQL_PASSWORD] -a PRIMARY_IP -b SECONDARY_IP |
2401 | +# primary |
2402 | +# or ovmysqlrepl [-fqw] [-p MYSQL_PASSWORD] -a PRIMARY_IP -b SECONDARY_IP |
2403 | +# secondary |
2404 | +# or ovmysqlrepl [-s] [-p MYSQL_PASSWORD] status |
2405 | +# or ovmysqlrepl [-s] list |
2406 | +# or ovmysqlrepl [-p MYSQL_PASSWORD] test|mode|ip|backlog|stop|start |
2407 | +# or ovmysqlrepl -h |
2408 | +# or ovmysqlrepl -V |
2409 | +_ovmysqlrepl() |
2410 | +{ |
2411 | + local opts='-h -V -a -b -f -p -q -s -w ' |
2412 | + typeset -i allowed_nonopt_words=1 |
2413 | + |
2414 | + COMPREPLY=() |
2415 | + |
2416 | + for i in $(seq $COMP_CWORD); do |
2417 | + # we've run out of the allowed number of non-option arguments; |
2418 | + # perform no further completion |
2419 | + (( $allowed_nonopt_words == 0 )) && return |
2420 | + |
2421 | + case ${COMP_WORDS[i]} in |
2422 | + -*h*|-*V*) |
2423 | + # perform no further completion |
2424 | + allowed_nonopt_words=0 |
2425 | + ;; |
2426 | + -*a|-*b|-*p) |
2427 | + (( allowed_nonopt_words++ )) |
2428 | + ;; |
2429 | + -*) |
2430 | + : |
2431 | + ;; |
2432 | + *) |
2433 | + (( allowed_nonopt_words-- )) |
2434 | + ;; |
2435 | + esac |
2436 | + done |
2437 | + |
2438 | + local cur=${COMP_WORDS[COMP_CWORD]} |
2439 | + local prev=${COMP_WORDS[COMP_CWORD-1]} |
2440 | + |
2441 | + case $cur in |
2442 | + -*) |
2443 | + COMPREPLY=( $(compgen -W "$opts" -- $cur) ) |
2444 | + ;; |
2445 | + *) |
2446 | + case $prev in |
2447 | + -*a|-*b) |
2448 | + _known_hosts_real -a "$cur" |
2449 | + ;; |
2450 | + -*p) |
2451 | + # no useful completion |
2452 | + : |
2453 | + ;; |
2454 | + *) |
2455 | + actions=$(_valid_actions \ |
2456 | + "primary=a b|q p" \ |
2457 | + "secondary=a b|f q p w" \ |
2458 | + "status=|p s" \ |
2459 | + "list=|s" \ |
2460 | + "test|mode|ip|backlog|stop|start=|p" \ |
2461 | + ) |
2462 | + COMPREPLY=( $(compgen -W "${actions[*]}" -- $cur) ) |
2463 | + ;; |
2464 | + esac |
2465 | + ;; |
2466 | + esac |
2467 | +} |
2468 | + |
2469 | +complete -F _ovmysqlrepl ovmysqlrepl |
2470 | + |
2471 | +# ovreplicate [-e INSTANCE_NAME] [-p MYSQL_PASSWORD] |
2472 | +# setup|switchover|promote|demote|stop|start |
2473 | +# or ovreplicate [-s] status|list [INSTANCE_NAME...] |
2474 | +# or ovreplicate test [INSTANCE_NAME...] |
2475 | +# or ovreplicate -h |
2476 | +# or ovreplicate -V |
2477 | +_ovreplicate() |
2478 | +{ |
2479 | + local opts='-h -V -e -p -s' |
2480 | + typeset -i allowed_nonopt_words=1 |
2481 | + |
2482 | + COMPREPLY=() |
2483 | + |
2484 | + for i in $(seq $COMP_CWORD); do |
2485 | + # we've run out of the allowed number of non-option arguments; |
2486 | + # perform no further completion |
2487 | + (( $allowed_nonopt_words == 0 )) && return |
2488 | + |
2489 | + case ${COMP_WORDS[i]} in |
2490 | + -*h*|-*V*) |
2491 | + # perform no further completion |
2492 | + allowed_nonopt_words=0 |
2493 | + ;; |
2494 | + -*e|-*p) |
2495 | + (( allowed_nonopt_words++ )) |
2496 | + ;; |
2497 | + -*|status|list|test) |
2498 | + : |
2499 | + ;; |
2500 | + *) |
2501 | + (( allowed_nonopt_words-- )) |
2502 | + ;; |
2503 | + esac |
2504 | + done |
2505 | + |
2506 | + local cur=${COMP_WORDS[COMP_CWORD]} |
2507 | + local prev=${COMP_WORDS[COMP_CWORD-1]} |
2508 | + |
2509 | + case $cur in |
2510 | + -*) |
2511 | + COMPREPLY=( $(compgen -W "$opts" -- $cur) ) |
2512 | + ;; |
2513 | + *) |
2514 | + case $prev in |
2515 | + -*e) |
2516 | + COMPREPLY=( \ |
2517 | + $(compgen -W "$(list_openvista_instances)" -- $cur) ) |
2518 | + ;; |
2519 | + -*p) |
2520 | + # no useful completion |
2521 | + : |
2522 | + ;; |
2523 | + status|list|test) |
2524 | + COMPREPLY=( \ |
2525 | + $(compgen -W "$(list_openvista_instances)" -- $cur) ) |
2526 | + ;; |
2527 | + *) |
2528 | + actions=$(_valid_actions \ |
2529 | + "setup|switchover|promote|demote|stop|start=|e p" \ |
2530 | + "status|list=|s" \ |
2531 | + "test=|" \ |
2532 | + ) |
2533 | + COMPREPLY=( $(compgen -W "${actions[*]}" -- $cur) ) |
2534 | + ;; |
2535 | + esac |
2536 | + ;; |
2537 | + esac |
2538 | +} |
2539 | + |
2540 | +complete -F _ovreplicate ovreplicate |
2541 | + |
2542 | +# ovsshkey [-p PASSWORD_PROMPT] [-q] [-s INSTANCE_NAME] [-t] REMOTE_HOST |
2543 | +# or ovsshkey -h |
2544 | +# or ovsshkey -V |
2545 | +# or ovsshkey -k CALLER |
2546 | +# or ovsshkey -n |
2547 | +_ovsshkey() |
2548 | +{ |
2549 | + local opts='-h -V -k -n -p -q -s -t ' |
2550 | + typeset -i allowed_nonopt_words=1 |
2551 | + |
2552 | + COMPREPLY=() |
2553 | + |
2554 | + for i in $(seq $COMP_CWORD); do |
2555 | + # we've run out of the allowed number of non-option arguments; |
2556 | + # perform no further completion |
2557 | + (( $allowed_nonopt_words == 0 )) && return |
2558 | + |
2559 | + case ${COMP_WORDS[i]} in |
2560 | + -*h*|-*V*|-*n*) |
2561 | + # perform no further completion |
2562 | + allowed_nonopt_words=0 |
2563 | + ;; |
2564 | + -*p|-*s) |
2565 | + (( allowed_nonopt_words++ )) |
2566 | + ;; |
2567 | + -*) |
2568 | + : |
2569 | + ;; |
2570 | + *) |
2571 | + (( allowed_nonopt_words-- )) |
2572 | + ;; |
2573 | + esac |
2574 | + done |
2575 | + |
2576 | + local cur=${COMP_WORDS[COMP_CWORD]} |
2577 | + local prev=${COMP_WORDS[COMP_CWORD-1]} |
2578 | + |
2579 | + case $cur in |
2580 | + -*) |
2581 | + COMPREPLY=( $(compgen -W "$opts" -- $cur) ) |
2582 | + ;; |
2583 | + *) |
2584 | + case $prev in |
2585 | + -*p|-*k) |
2586 | + # no useful completion |
2587 | + : |
2588 | + ;; |
2589 | + -*s) |
2590 | + COMPREPLY=( \ |
2591 | + $(compgen -W "$(list_openvista_instances)" -- $cur) ) |
2592 | + ;; |
2593 | + *) |
2594 | + _known_hosts_real -a "$cur" |
2595 | + ;; |
2596 | + esac |
2597 | + ;; |
2598 | + esac |
2599 | +} |
2600 | + |
2601 | +complete -F _ovsshkey ovsshkey |
2602 | + |
2603 | +# ovgenconfig [-e] [-s SUBDIRECTORY] INSTANCE_NAME CONF_FILE [SETTING...] |
2604 | +# or ovgenconfig -h |
2605 | +# or ovgenconfig -V |
2606 | +_ovgenconfig() |
2607 | +{ |
2608 | + local opts='-h -V -e -s ' |
2609 | + # The ovgenconfig command allows more than these two non-option words, but |
2610 | + # we have no basis on which to provide completion of the settings arguments, |
2611 | + # so completion only allows for the two words. |
2612 | + typeset -i allowed_nonopt_words=2 |
2613 | + |
2614 | + COMPREPLY=() |
2615 | + |
2616 | + for i in $(seq $COMP_CWORD); do |
2617 | + # we've run out of the allowed number of non-option arguments; |
2618 | + # perform no further completion |
2619 | + (( $allowed_nonopt_words == 0 )) && return |
2620 | + |
2621 | + case ${COMP_WORDS[i]} in |
2622 | + -*h*|-*V*) |
2623 | + # perform no further completion |
2624 | + allowed_nonopt_words=0 |
2625 | + ;; |
2626 | + -*s) |
2627 | + (( allowed_nonopt_words++ )) |
2628 | + ;; |
2629 | + -*) |
2630 | + : |
2631 | + ;; |
2632 | + *) |
2633 | + (( allowed_nonopt_words-- )) |
2634 | + ;; |
2635 | + esac |
2636 | + done |
2637 | + |
2638 | + local cur=${COMP_WORDS[COMP_CWORD]} |
2639 | + local prev=${COMP_WORDS[COMP_CWORD-1]} |
2640 | + |
2641 | + case $cur in |
2642 | + -*) |
2643 | + COMPREPLY=( $(compgen -W "$opts" -- $cur) ) |
2644 | + ;; |
2645 | + *) |
2646 | + case $prev in |
2647 | + -*s) |
2648 | + # We don't have the instance name at this point from which |
2649 | + # to get the directories list, but only two of the standard |
2650 | + # subdirectories make sense anyway. |
2651 | + COMPREPLY=( \ |
2652 | + $(compgen -W "etc replication" -- $cur) ) |
2653 | + ;; |
2654 | + *) |
2655 | + if [[ "$allowed_nonopt_words" == 1 ]]; then |
2656 | + # instance name |
2657 | + COMPREPLY=( \ |
2658 | + $(compgen -W "$(list_openvista_instances)" -- $cur) ) |
2659 | + elif [[ "$allowed_nonopt_words" == 0 ]]; then |
2660 | + # configuration file name (basename + extension) |
2661 | + local s_flag_i subdirectory |
2662 | + if s_flag_i=$(array_index_re "-[a-z]*s" \ |
2663 | + "${COMP_WORDS[@]}"); then |
2664 | + subdirectory=${COMP_WORDS[s_flag_i+1]} |
2665 | + else |
2666 | + subdirectory=etc |
2667 | + fi |
2668 | + case $subdirectory in |
2669 | + etc) |
2670 | + COMPREPLY=( $(compgen -W "$(echo \ |
2671 | + backups.conf \ |
2672 | + journals.conf \ |
2673 | + replication.conf \ |
2674 | + )" -- $cur) ) |
2675 | + ;; |
2676 | + replication) |
2677 | + COMPREPLY=( $(compgen -W "$(echo \ |
2678 | + lsyncd.conf.xml \ |
2679 | + rsyncd.conf \ |
2680 | + )" -- $cur) ) |
2681 | + ;; |
2682 | + esac |
2683 | + fi |
2684 | + ;; |
2685 | + esac |
2686 | + ;; |
2687 | + esac |
2688 | +} |
2689 | + |
2690 | +complete -F _ovgenconfig ovgenconfig |
2691 | |
2692 | === modified file 'scripts/etc/init.d/openvista' |
2693 | --- scripts/etc/init.d/openvista 2010-04-01 03:46:09 +0000 |
2694 | +++ scripts/etc/init.d/openvista 2011-08-22 16:52:24 +0000 |
2695 | @@ -22,29 +22,29 @@ |
2696 | # |
2697 | ### BEGIN INIT INFO |
2698 | # Provides: openvista |
2699 | -# Required-Start: $all openvista-databases |
2700 | -# Required-Stop: $all openvista-databases |
2701 | +# Required-Start: $all openvista-databases openvista-replication |
2702 | +# Required-Stop: $all openvista-databases openvista-replication |
2703 | # Default-Start: 2 3 4 5 |
2704 | # Default-Stop: 0 1 6 |
2705 | # Short-Description: Application-level startup/shutdown script for OpenVista Server |
2706 | ### END INIT INFO |
2707 | |
2708 | |
2709 | -# Copyright (C) 2009 Medsphere Systems Corporation |
2710 | +# Copyright (C) 2009-2010 Medsphere Systems Corporation |
2711 | # |
2712 | # This program is free software; you can redistribute it and/or modify it solely |
2713 | # under the terms of the GNU Affero General Public License version 3 as published |
2714 | # by the Free Software Foundation. |
2715 | -# |
2716 | +# |
2717 | # This program is distributed in the hope that it will be useful, but WITHOUT |
2718 | # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
2719 | # FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License |
2720 | # for more details. |
2721 | -# |
2722 | +# |
2723 | # You should have received a copy of the GNU Affero General Public License |
2724 | # along with this program. If not, see <http://www.gnu.org/licenses>. |
2725 | -# |
2726 | -# You can contact Medsphere Systems Corporation headquarters at 1917 Palomar |
2727 | +# |
2728 | +# You can contact Medsphere Systems Corporation headquarters at 1917 Palomar |
2729 | # Oaks Way, Suite 200, Carlsbad, CA 92008 or at legal@medsphere.com. |
2730 | |
2731 | |
2732 | @@ -57,14 +57,27 @@ |
2733 | # here, so we have to pick one. |
2734 | [ -f /usr/lib/openvista/functions ] || exit 0 |
2735 | |
2736 | -# Source function library. |
2737 | -[ -f /etc/rc.d/init.d/functions ] && . /etc/rc.d/init.d/functions |
2738 | -[ -f /lib/lsb/init-functions ] && . /lib/lsb/init-functions |
2739 | +# source function libraries |
2740 | +# CentOS/RHEL, provides action(), status() |
2741 | +[[ -f /etc/rc.d/init.d/functions ]] && . /etc/rc.d/init.d/functions |
2742 | +# Ubuntu/Debian, provides log_daemon_msg(), status_of_proc() |
2743 | +[[ -f /lib/lsb/init-functions ]] && . /lib/lsb/init-functions |
2744 | +# OpenVista |
2745 | . /usr/lib/openvista/functions |
2746 | |
2747 | +log_command_usage "$@" |
2748 | + |
2749 | +usage() |
2750 | +{ |
2751 | + # Display usage information. |
2752 | + cat <<EOF |
2753 | +Usage: openvista {start|stop|restart|force-reload} [INSTANCE_NAME] |
2754 | +EOF |
2755 | +} |
2756 | + |
2757 | run_hook() |
2758 | { |
2759 | - set_gtm_env "$1" || return 1 |
2760 | + set_gtm_env -v "$1" || return $? |
2761 | |
2762 | umask 007 |
2763 | |
2764 | @@ -72,23 +85,38 @@ |
2765 | |
2766 | routine="$2" |
2767 | |
2768 | - logger -p user.info -t "openvista[$$]" -- Running $routine in $instance |
2769 | - |
2770 | - if [ `id -u` -eq 0 ]; then |
2771 | + # See comments in the openvista-databases script for explanation of the |
2772 | + # clean flag. It is normally removed by openvista-databases and should not |
2773 | + # be found at this point, but it will also be removed here just in case the |
2774 | + # scripts are run out of order. |
2775 | + clean_flag_file="/etc/openvista/clean_shutdown_$instance" |
2776 | + if [[ "$routine" == "ZSTART" ]] && [[ -e "$clean_flag_file" ]]; then |
2777 | + if rm -f "$clean_flag_file"; then |
2778 | + log -l "Removed the clean shutdown flag for $instance database" |
2779 | + else |
2780 | + log -l \ |
2781 | + "Failed to remove the clean shutdown flag for $instance database" |
2782 | + fi |
2783 | + fi |
2784 | + |
2785 | + log -l "Running $routine in $instance" |
2786 | + |
2787 | + if [ $(id -u) -eq 0 ]; then |
2788 | su -m -c "echo HALT | mumps -run \"^$routine\"" "$user" 2>&1 \ |
2789 | | grep -v '^$' \ |
2790 | - | logger -p user.info -t "openvista[$$]" |
2791 | + | log -lp |
2792 | retval=${PIPESTATUS[0]} |
2793 | else |
2794 | echo HALT | mumps -run "^$routine" 2>&1 \ |
2795 | | grep -v '^$' \ |
2796 | - | logger -p user.info -t "openvista[$$]" |
2797 | + | log -lp |
2798 | retval=${PIPESTATUS[1]} |
2799 | fi |
2800 | |
2801 | # mumps returns 253 if the routine does not exist |
2802 | if [ $retval -eq 253 ]; then |
2803 | - logger -p user.info -t "openvista[$$]" -- No routine named $routine was found in $instance, skipping $instance |
2804 | + log -lc "No routine named $routine was found in $instance," \ |
2805 | + "skipping $instance" |
2806 | |
2807 | # fake success |
2808 | retval=0 |
2809 | @@ -99,91 +127,64 @@ |
2810 | return 0 |
2811 | } |
2812 | |
2813 | -# check permissions |
2814 | -in_groups || { |
2815 | - echo "openvista: permission denied" >&2 |
2816 | - exit 4 # LSB: user had insufficient privilege |
2817 | -} |
2818 | - |
2819 | -# check for for valid arguments (requires correct permissions to do; must happen after permission checks) |
2820 | -if [ -n "$2" ]; then |
2821 | - set_gtm_env "$2" || { |
2822 | - echo "openvista: $instance: Not an OpenVista instance" >&2 |
2823 | - exit 2 # LSB: invalid or excess argument(s) |
2824 | - } |
2825 | +# check for for valid arguments |
2826 | +instance=$2 |
2827 | +if [[ "$instance" ]]; then |
2828 | + is_openvista_instance "$instance" || exit_command 2 "$ov_error" |
2829 | fi |
2830 | |
2831 | case $1 in |
2832 | + # For 'start' and 'stop', the ov_init_action calls provide the exit value |
2833 | + # for the script. The CentOS/RHEL subsys lock is set and cleared |
2834 | + # independently of the return code, because a partial failure of one action |
2835 | + # should not cause the other to be skipped. The lock is only set or cleared |
2836 | + # when being called without an instance name argument. Any error from |
2837 | + # touching or removing the lock file is hidden from the console so that the |
2838 | + # script can be run without an instance name by a non-root admin without |
2839 | + # printing confusing error messages. |
2840 | start) |
2841 | - if [ -z "$2" ]; then |
2842 | - if function_exists "action"; then |
2843 | - echo "Starting OpenVista..." |
2844 | - elif function_exists "log_daemon_msg"; then |
2845 | - log_daemon_msg "Running startup hooks for OpenVista databases" |
2846 | - fi |
2847 | - |
2848 | - for instance in `list_openvista_instances`; do |
2849 | - if function_exists "action"; then |
2850 | - action $" Running startup hooks for $instance: " run_hook "$instance" ZSTART |
2851 | - elif function_exists "log_daemon_msg"; then |
2852 | - log_progress_msg "$instance" |
2853 | - run_hook "$instance" ZSTART || end_msg=1 |
2854 | - else |
2855 | - run_hook "$instance" ZSTART |
2856 | - fi |
2857 | - done |
2858 | - |
2859 | - if function_exists "log_daemon_msg"; then |
2860 | - log_end_msg ${end_msg:-0} |
2861 | - fi |
2862 | + run_start_hook() { run_hook "$1" ZSTART; } |
2863 | + instance_function=run_start_hook |
2864 | + if function_exists "action"; then |
2865 | + # CentOS/RHEL |
2866 | + touch /var/lock/subsys/openvista \ |
2867 | + 2>&1 | log -lp |
2868 | + ov_init_action_rhel "$instance_function" \ |
2869 | + "Starting OpenVista" \ |
2870 | + "Running startup hooks for {instance} database" \ |
2871 | + "$instance" |
2872 | + elif function_exists "log_daemon_msg"; then |
2873 | + # Ubuntu/Debian |
2874 | + ov_init_action_debian "$instance_function" \ |
2875 | + "Running startup hooks for OpenVista databases" \ |
2876 | + "Running startup hooks for OpenVista database" \ |
2877 | + "$instance" |
2878 | else |
2879 | - if function_exists "action"; then |
2880 | - action $"Running startup hooks for $instance: " run_hook "$instance" ZSTART |
2881 | - elif function_exists "log_daemon_msg"; then |
2882 | - log_daemon_msg "Running startup hooks for OpenVista databases" "$instance" |
2883 | - run_hook "$instance" ZSTART |
2884 | - log_end_msg $? |
2885 | - else |
2886 | - run_hook "$instance" ZSTART |
2887 | - fi |
2888 | + # other |
2889 | + ov_init_action_other "$instance_function" "$instance" |
2890 | fi |
2891 | ;; |
2892 | stop) |
2893 | - if [ -z "$2" ]; then |
2894 | - if function_exists "action"; then |
2895 | - echo "Stopping OpenVista..." |
2896 | - elif function_exists "log_daemon_msg"; then |
2897 | - log_daemon_msg "Running shutdown hooks for OpenVista databases" |
2898 | - fi |
2899 | - |
2900 | - for instance in `list_openvista_instances`; do |
2901 | - if function_exists "action"; then |
2902 | - action $" Running shutdown hooks for $instance: " run_hook "$instance" ZSTOP |
2903 | - elif function_exists "log_daemon_msg"; then |
2904 | - log_progress_msg "$instance" |
2905 | - run_hook "$instance" ZSTOP || end_msg=1 |
2906 | - else |
2907 | - run_hook "$instance" ZSTOP |
2908 | - fi |
2909 | - done |
2910 | - |
2911 | - if function_exists "log_daemon_msg"; then |
2912 | - log_end_msg ${end_msg:-0} |
2913 | - fi |
2914 | + run_stop_hook() { run_hook "$1" ZSTOP; } |
2915 | + instance_function=run_stop_hook |
2916 | + if function_exists "action"; then |
2917 | + # CentOS/RHEL |
2918 | + [[ "$instance" ]] || rm -f /var/lock/subsys/openvista \ |
2919 | + 2>&1 | log -lp |
2920 | + ov_init_action_rhel "$instance_function" \ |
2921 | + "Running shutdown hooks for OpenVista databases" \ |
2922 | + "Running shutdown hooks for {instance} database" \ |
2923 | + "$instance" |
2924 | + elif function_exists "log_daemon_msg"; then |
2925 | + # Ubuntu/Debian |
2926 | + ov_init_action_debian "$instance_function" \ |
2927 | + "Running shutdown hooks for OpenVista databases" \ |
2928 | + "Running shutdown hooks for OpenVista database" \ |
2929 | + "$instance" |
2930 | else |
2931 | - if function_exists "action"; then |
2932 | - action $"Running shutdown hooks for $instance: " run_hook "$instance" ZSTOP |
2933 | - elif function_exists "log_daemon_msg"; then |
2934 | - log_daemon_msg "Running shutdown hooks for OpenVista databases" "$instance" |
2935 | - run_hook "$instance" ZSTOP |
2936 | - log_end_msg $? |
2937 | - else |
2938 | - run_hook "$instance" ZSTOP |
2939 | - fi |
2940 | + # other |
2941 | + ov_init_action_other "$instance_function" "$instance" |
2942 | fi |
2943 | - |
2944 | - # give background jobs (e.g., TaskMan) some time to wake up and realize they've been asked to shut down |
2945 | - sleep 5 |
2946 | ;; |
2947 | restart|force-reload) |
2948 | $0 stop $2 |
2949 | @@ -191,12 +192,11 @@ |
2950 | ;; |
2951 | status) |
2952 | # print usage info for humans, but fake success for RHCS |
2953 | - echo "Usage: openvista {start|stop|restart|force-reload} [INSTANCE_NAME]" |
2954 | + usage |
2955 | exit 0 # LSB: program is running or service is OK |
2956 | ;; |
2957 | *) |
2958 | - echo "Usage: openvista {start|stop|restart|force-reload} [INSTANCE_NAME]" >&2 |
2959 | + usage >&2 |
2960 | exit 2 # LSB: invalid or excess argument(s) |
2961 | ;; |
2962 | esac |
2963 | - |
2964 | |
2965 | === modified file 'scripts/etc/init.d/openvista-databases' |
2966 | --- scripts/etc/init.d/openvista-databases 2010-04-01 03:46:09 +0000 |
2967 | +++ scripts/etc/init.d/openvista-databases 2011-08-22 16:52:24 +0000 |
2968 | @@ -37,21 +37,21 @@ |
2969 | ### END INIT INFO |
2970 | |
2971 | |
2972 | -# Copyright (C) 2009 Medsphere Systems Corporation |
2973 | +# Copyright (C) 2009-2010 Medsphere Systems Corporation |
2974 | # |
2975 | # This program is free software; you can redistribute it and/or modify it solely |
2976 | # under the terms of the GNU Affero General Public License version 3 as published |
2977 | # by the Free Software Foundation. |
2978 | -# |
2979 | +# |
2980 | # This program is distributed in the hope that it will be useful, but WITHOUT |
2981 | # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
2982 | # FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License |
2983 | # for more details. |
2984 | -# |
2985 | +# |
2986 | # You should have received a copy of the GNU Affero General Public License |
2987 | # along with this program. If not, see <http://www.gnu.org/licenses>. |
2988 | -# |
2989 | -# You can contact Medsphere Systems Corporation headquarters at 1917 Palomar |
2990 | +# |
2991 | +# You can contact Medsphere Systems Corporation headquarters at 1917 Palomar |
2992 | # Oaks Way, Suite 200, Carlsbad, CA 92008 or at legal@medsphere.com. |
2993 | |
2994 | |
2995 | @@ -62,177 +62,363 @@ |
2996 | # |
2997 | # Note that exiting 0 here is against LSB, but Debian policy and LSB conflict |
2998 | # here, so we have to pick one. |
2999 | -[ -f /usr/lib/openvista/functions ] || exit 0 |
3000 | +[[ -f /usr/lib/openvista/functions ]] || exit 0 |
3001 | |
3002 | -# Source function library. |
3003 | -[ -f /etc/rc.d/init.d/functions ] && . /etc/rc.d/init.d/functions |
3004 | -[ -f /lib/lsb/init-functions ] && . /lib/lsb/init-functions |
3005 | +# source function libraries |
3006 | +# CentOS/RHEL, provides action(), status() |
3007 | +[[ -f /etc/rc.d/init.d/functions ]] && . /etc/rc.d/init.d/functions |
3008 | +# Ubuntu/Debian, provides log_daemon_msg(), status_of_proc() |
3009 | +[[ -f /lib/lsb/init-functions ]] && . /lib/lsb/init-functions |
3010 | +# OpenVista |
3011 | . /usr/lib/openvista/functions |
3012 | |
3013 | +log_command_usage "$@" |
3014 | + |
3015 | +usage() |
3016 | +{ |
3017 | + # Display usage information. |
3018 | + cat <<EOF |
3019 | +Usage: openvista-databases {start|stop|restart|force-reload} [INSTANCE_NAME] |
3020 | +EOF |
3021 | +} |
3022 | + |
3023 | recover_backward() |
3024 | { |
3025 | - set_gtm_env "$1" || return 1 |
3026 | + instance=$1 |
3027 | + set_gtm_env -v "$instance" || return $? |
3028 | |
3029 | umask 007 |
3030 | |
3031 | - logger -p user.info -t "openvista-databases[$$]" -- Performing recovery on $instance database |
3032 | - |
3033 | - mupip journal -recover -backward '*' 2>&1 \ |
3034 | - | grep -v '^$' \ |
3035 | - | logger -p user.info -t "openvista-databases[$$]" |
3036 | - retval=${PIPESTATUS[0]} |
3037 | - [ $retval -eq 0 ] || return 1 |
3038 | + # A recovery is performed only following a non-clean shutdown. |
3039 | + # |
3040 | + # When terminate_processes() stops mumps processes, it checks that they |
3041 | + # have, in fact, exited. If they have, it writes a 'clean' flag to |
3042 | + # /etc/openvista/clean_shutdown_[instance]. |
3043 | + # |
3044 | + # Here, that flag is checked and removed. The recovery is only performed if |
3045 | + # the shutdown was not clean. Otherwise, rolling back the journal on a |
3046 | + # primary replicating server could prevent the secondary from getting the |
3047 | + # transactions that were backlogged at the time of the primary's shutdown, |
3048 | + # and so the secondary instance(s) would need to be resynced with a complete |
3049 | + # backup and restore (using `ovinstancerepl resync [instance]`) in order to |
3050 | + # restart replication. |
3051 | + # |
3052 | + # The clean flag should normally be removed here, but the openvista init |
3053 | + # script will also make sure that the flag is removed just before it runs |
3054 | + # the ZSTART routine on an instance. |
3055 | + if clean_flag get "$instance"; then |
3056 | + log -l "Found the clean shutdown flag for $instance database" |
3057 | + clean_flag set "$instance" false |
3058 | + else |
3059 | + log -l "Did not find the clean shutdown flag for $instance database" |
3060 | + log -l "Performing recovery on $instance database" |
3061 | + mupip journal -recover -backward '*' 2>&1 \ |
3062 | + | grep -v '^$' \ |
3063 | + | log -lp |
3064 | + (( "${PIPESTATUS[0]}" == 0 )) || return 1 |
3065 | + fi |
3066 | |
3067 | # According to Bhaskar, database files should not need to be run down after |
3068 | # a successful recovery. However, we've observed GT.M complaining about |
3069 | # databases requring rundown after a system crash, even after successful |
3070 | - # journal recovery, on both our own OpenVista appliance and the WorldVistA |
3071 | - # VOE "four-slice toaster" appliance. An easy (and somewhat reliable) way to |
3072 | - # trigger the not-rundown effect is to connect with CIS, then halt the machine |
3073 | - # by killing qemu. Upon the next boot, the journal recovery will run, but |
3074 | - # attempts to access the database will result in not-rundown errors. Adding |
3075 | - # a call to mupip rundown here seems to fix the issue. |
3076 | + # journal recovery, on both our own OpenVista appliance and the WorldVistA |
3077 | + # VOE "four-slice toaster" appliance. An easy (and somewhat reliable) way |
3078 | + # to trigger the not-rundown effect is to connect with CIS, then halt the |
3079 | + # machine by killing qemu. Upon the next boot, the journal recovery will |
3080 | + # run, but attempts to access the database will result in not-rundown |
3081 | + # errors. Adding a call to mupip rundown here seems to fix the issue. |
3082 | mupip rundown -region DEFAULT 2>&1 \ |
3083 | | grep -v '^$' \ |
3084 | - | logger -p user.info -t "openvista-databases[$$]" |
3085 | - retval=${PIPESTATUS[0]} |
3086 | - [ $retval -eq 0 ] || return 1 |
3087 | - |
3088 | - # Re-enable journaling |
3089 | - mupip set -journal="ENABLE,ON,BEFORE_IMAGES" -region DEFAULT 2>&1 \ |
3090 | - | grep -v '^$' \ |
3091 | - | logger -p user.info -t "openvista-databases[$$]" |
3092 | - retval=${PIPESTATUS[0]} |
3093 | - [ $retval -eq 0 ] || return 1 |
3094 | + | log -lp |
3095 | + (( "${PIPESTATUS[0]}" == 0 )) || return 1 |
3096 | + |
3097 | + # Re-enable journaling and, if configured, replication |
3098 | + case $replication_mode in |
3099 | + primary|secondary) |
3100 | + log -lc "Re-enabling journaling and replication on $instance" \ |
3101 | + "database" |
3102 | + |
3103 | + # Turning on replication automatically enables journaling. |
3104 | + mupip set -replication=ON \ |
3105 | + -region DEFAULT 2>&1 \ |
3106 | + | grep -v '^$' \ |
3107 | + | log -lp |
3108 | + (( "${PIPESTATUS[0]}" == 0 )) || return 1 |
3109 | + ;; |
3110 | + *) |
3111 | + log -l "Re-enabling journaling on $instance database" |
3112 | + |
3113 | + mupip set -journal="ENABLE,ON,BEFORE_IMAGES" \ |
3114 | + -replication=OFF \ |
3115 | + -region DEFAULT 2>&1 \ |
3116 | + | grep -v '^$' \ |
3117 | + | log -lp |
3118 | + (( "${PIPESTATUS[0]}" == 0 )) || return 1 |
3119 | + ;; |
3120 | + esac |
3121 | + |
3122 | + log -l "Creating new physical segment for SCRATCH on $instance database" |
3123 | |
3124 | # Back up scratch.dat - we're going to create a new one. The previous |
3125 | # backup will be overwritten. |
3126 | - mv -f "$root/$instance/globals/scratch.dat" "$root/$instance/globals/scratch.dat~" |
3127 | - retval=$? |
3128 | - [ $retval -eq 0 ] || return 1 |
3129 | + mv -f "$root/$instance/globals/scratch.dat" \ |
3130 | + "$root/$instance/globals/scratch.dat~" \ |
3131 | + || return 1 |
3132 | |
3133 | mupip create -region=SCRATCH 2>&1 \ |
3134 | | grep -v '^$' \ |
3135 | - | logger -p user.info -t "openvista-databases[$$]" |
3136 | - retval=${PIPESTATUS[0]} |
3137 | - [ $retval -eq 0 ] || return 1 |
3138 | + | log -lp |
3139 | + (( "${PIPESTATUS[0]}" == 0 )) || return 1 |
3140 | |
3141 | - logger -p user.info -t "openvista-databases[$$]" -- Database recovery complete, $instance database is ready for use |
3142 | + log -l "Database $instance is ready for use" |
3143 | |
3144 | return 0 |
3145 | } |
3146 | |
3147 | terminate_processes() |
3148 | { |
3149 | - set_gtm_env "$1" || return 1 |
3150 | - |
3151 | - logger -p user.info -t "openvista-databases[$$]" -- Terminating mumps processes in $instance |
3152 | - |
3153 | - # find all processes using this database and kill them |
3154 | - for pid in `ls /proc`; do |
3155 | - [ -L "/proc/$pid/cwd" ] || continue |
3156 | - cwd=`readlink "/proc/$pid/cwd"` |
3157 | - [ "$root/$instance/tmp" = "$cwd" ] || continue |
3158 | - |
3159 | - [ -L "/proc/$pid/exe" ] || continue |
3160 | - exe=`readlink "/proc/$pid/exe"` |
3161 | - exe_base=`basename "$exe"` |
3162 | - [ "mumps" = "$exe_base" ] || continue |
3163 | - |
3164 | - mupip stop "$pid" 2>&1 \ |
3165 | - | grep -v '^$' \ |
3166 | - | logger -p user.info -t "openvista-databases[$$]" |
3167 | + # Make sure all mumps processes using the database are stopped. |
3168 | + # Early in the shutdown sequence the /etc/init.d/openvista script calls |
3169 | + # the ZSTOP routine on the instance to stop OpenVista mumps processes. |
3170 | + # This function first allows some time for the processes to stop |
3171 | + # themselves in response to that routine, and then it calls `mupip stop` |
3172 | + # to more forcefully stop them. It then waits again for the processes to |
3173 | + # be stopped. Both wait loops check each second to see if the processes |
3174 | + # are stopped, so the function will not wait any longer than the time it |
3175 | + # actually takes for the processes to stop. There are at least three |
3176 | + # reasons to wait: |
3177 | + # 1) To allow applications to complete whatever task they are in the |
3178 | + # middle of and stop at a point that makes sense in the context of |
3179 | + # the application. |
3180 | + # 2) To keep the system from shutting down while a process is writing |
3181 | + # data, which might corrupt the database. |
3182 | + # 3) To allow openvista-databases to write a 'clean' flag |
3183 | + # (representing that the problem of #2 was avoided) so that on |
3184 | + # system startup, openvista-databases will know that a database |
3185 | + # recovery won't be necessary. |
3186 | + |
3187 | + instance=$1 |
3188 | + set_gtm_env -v "$instance" || return $? |
3189 | + |
3190 | + log -l "Terminating OpenVista processes in $instance" |
3191 | + |
3192 | + local mumps_pids |
3193 | + |
3194 | + # allow time for ZSTOP, called by openvista, to succeed in stopping tasks |
3195 | + # The %ZISTCPS routine listens on the RPC broker port for 30 seconds at a |
3196 | + # time and will only respond to ZSTOP after its current listen period is |
3197 | + # up. So we will wait up to 35 seconds. |
3198 | + local max_wait=35 |
3199 | + for (( i=0; i!=$max_wait; i++ )); do |
3200 | + mumps_pids=( $(get_mumps_pids "$instance") ) |
3201 | + (( "${#mumps_pids[@]}" == 0 )) && break |
3202 | + sleep 1 |
3203 | done |
3204 | - |
3205 | - # wait for processes to die |
3206 | - sleep 1 |
3207 | + log -l "Waited $i seconds for all processes to die from ZSTOP" |
3208 | + |
3209 | + # kill any processes that are still using this database |
3210 | + # Generally, they should have already been stopped by ZSTOP. |
3211 | + mumps_pids=( $(get_mumps_pids "$instance") ) |
3212 | + mumps_process_count=${#mumps_pids[@]} |
3213 | + if (( "$mumps_process_count" != 0 )); then |
3214 | + log -l "$mumps_process_count mumps processes remain after ZSTOP" |
3215 | + local num |
3216 | + for pid in "${mumps_pids[@]}"; do |
3217 | + num=$(( $(array_index "$pid" "${mumps_pids[@]}") + 1 )) |
3218 | + log -lc "Calling MUPIP STOP on process $pid" \ |
3219 | + "($num of $mumps_process_count)" |
3220 | + mupip stop "$pid" 2>&1 \ |
3221 | + | grep -v '^$' \ |
3222 | + | log -lp |
3223 | + done |
3224 | + fi |
3225 | + |
3226 | + # wait for any mumps processes to stop, and set the clean flag |
3227 | + # The clean flag is used by recover_backward() to determine whether to run |
3228 | + # backward recovery on the database. If all mumps processes for the |
3229 | + # database were successfully stopped before shutdown, then the database |
3230 | + # should not require recovery, but if mumps processes were still running |
3231 | + # when the server was shut down, either because they failed to stop or |
3232 | + # because the shutdown was irregular, e.g. in the case of power failure, |
3233 | + # then the database potentially requires recovery. |
3234 | + if wait_for_mumps_to_stop "$instance"; then |
3235 | + clean_flag set "$instance" true |
3236 | + # This would be a good place to perform RUNDOWN on the database, except |
3237 | + # that the replication source server is still using the database file. |
3238 | + # So openvista-replication takes care of the database rundown. |
3239 | + else |
3240 | + clean_flag set "$instance" false |
3241 | + fi |
3242 | |
3243 | return 0 |
3244 | } |
3245 | |
3246 | +wait_for_mumps_to_stop() |
3247 | +{ |
3248 | + # Allow time for all mumps processes to stop. |
3249 | + local instance=$1 |
3250 | + |
3251 | + # how many times to give more time if mumps process count is reduced |
3252 | + local allowed_tries=6 |
3253 | + # seconds to wait for mumps process count to be zero |
3254 | + local allowed_delay=20 |
3255 | + |
3256 | + local try |
3257 | + local time_left |
3258 | + local mumps_pids |
3259 | + local initial_mumps_process_count |
3260 | + local mumps_process_count |
3261 | + for (( try=0; try!=$allowed_tries; try++ )); do |
3262 | + mumps_pids=( $(get_mumps_pids "$instance") ) |
3263 | + initial_mumps_process_count=${#mumps_pids[@]} |
3264 | + [[ "$initial_mumps_process_count" == 0 ]] || log -srlc \ |
3265 | + "$initial_mumps_process_count mumps processes still running," \ |
3266 | + "will wait up to $allowed_delay seconds for them to stop" |
3267 | + for (( time_left=$allowed_delay; time_left!=0; time_left-- )); do |
3268 | + mumps_pids=( $(get_mumps_pids "$instance") ) |
3269 | + mumps_process_count=${#mumps_pids[@]} |
3270 | + [[ "$mumps_process_count" == "0" ]] && break |
3271 | + sleep 1 |
3272 | + done |
3273 | + if [[ "$mumps_process_count" == "0" ]]; then |
3274 | + log -l "There are no mumps processes running" |
3275 | + break |
3276 | + elif (( "$mumps_process_count" >= \ |
3277 | + "$initial_mumps_process_count" )); then |
3278 | + log -srlc \ |
3279 | + "$mumps_process_count mumps processes are still running," \ |
3280 | + "but the allowed time of $allowed_delay seconds is exceeded" |
3281 | + log -srlc \ |
3282 | + "Remaining mumps processes:" ${mumps_pids[@]} |
3283 | + break |
3284 | + else |
3285 | + log -srlc \ |
3286 | + "The number of mumps processes was reduced in the past" \ |
3287 | + "$allowed_delay seconds, so another $allowed_delay seconds" \ |
3288 | + "will be allowed for remaining mumps processes to exit" |
3289 | + log -srlc \ |
3290 | + "Remaining mumps processes:" ${mumps_pids[@]} |
3291 | + fi |
3292 | + done |
3293 | + |
3294 | + (( "$mumps_process_count" == 0 )) |
3295 | +} |
3296 | + |
3297 | +clean_flag() |
3298 | +{ |
3299 | + # Set the clean flag for openvista-databases to find on startup. |
3300 | + local action=$1 |
3301 | + local instance=$2 |
3302 | + local is_clean=$3 |
3303 | + |
3304 | + root=$(get_ov_root) |
3305 | + clean_flag_file="$root/$instance/etc/clean_shutdown" |
3306 | + |
3307 | + case $action in |
3308 | + "get") |
3309 | + [[ -e "$clean_flag_file" ]] |
3310 | + return $? |
3311 | + ;; |
3312 | + "set") |
3313 | + if $is_clean; then |
3314 | + # write the clean flag |
3315 | + echo "openvista-databases completed a clean shutdown of" \ |
3316 | + "$instance database at $(date --rfc-3339=ns)" \ |
3317 | + >"$clean_flag_file" |
3318 | + if [[ -e "$clean_flag_file" ]]; then |
3319 | + log -lc \ |
3320 | + "Wrote the clean shutdown flag for $instance database" |
3321 | + else |
3322 | + log -lc \ |
3323 | + "Shutdown was clean for $instance database, but failed" \ |
3324 | + "to write the clean shutdown flag" |
3325 | + fi |
3326 | + else |
3327 | + # erase the clean flag |
3328 | + if [[ -e "$clean_flag_file" ]]; then |
3329 | + if rm -f "$clean_flag_file"; then |
3330 | + log -lc \ |
3331 | + "Removed the clean shutdown flag for $instance" \ |
3332 | + "database" |
3333 | + else |
3334 | + log -lc \ |
3335 | + "Failed to remove the clean shutdown flag for" \ |
3336 | + "$instance database" |
3337 | + |
3338 | + fi |
3339 | + fi |
3340 | + fi |
3341 | + ;; |
3342 | + *) |
3343 | + exit_command 1 "Error: clean_flag() received invalid argument(s)" |
3344 | + ;; |
3345 | + esac |
3346 | +} |
3347 | + |
3348 | # While it would be possible to run the journal recovery and database |
3349 | # rundown as a normal user, root access is required to delete/re-create |
3350 | # scratch.dat. Root access is also required to run mupip stop. |
3351 | -if [ `id -u` -ne 0 ]; then |
3352 | - echo "openvista-databases: Must be run as root" >&2 |
3353 | +if [[ $(id -u) != 0 ]]; then |
3354 | + log -sr "openvista-databases: Must be run as root" |
3355 | exit 4 # LSB: user had insufficient privilege |
3356 | fi |
3357 | |
3358 | -# check for for valid arguments (requires correct permissions to do; must happen after permission checks) |
3359 | -if [ -n "$2" ]; then |
3360 | - set_gtm_env "$2" || { |
3361 | - echo "openvista-databases: $instance: Not an OpenVista instance" >&2 |
3362 | - exit 2 # LSB: invalid or excess argument(s) |
3363 | - } |
3364 | +# check for for valid arguments |
3365 | +instance=$2 |
3366 | +if [[ "$instance" ]]; then |
3367 | + is_openvista_instance "$instance" || exit_command 2 "$ov_error" |
3368 | fi |
3369 | |
3370 | + |
3371 | case $1 in |
3372 | + # For 'start' and 'stop', the ov_init_action calls provide the exit value |
3373 | + # for the script. The CentOS/RHEL subsys lock is set and cleared |
3374 | + # independently of the return code, because a partial failure of one action |
3375 | + # should not cause the other to be skipped. The lock is only set or cleared |
3376 | + # when being called without an instance name argument. Any error from |
3377 | + # touching or removing the lock file is hidden from the console so that the |
3378 | + # script can be run without an instance name by a non-root admin without |
3379 | + # printing confusing error messages. |
3380 | start) |
3381 | - if [ -z "$2" ]; then |
3382 | - if function_exists "action"; then |
3383 | - echo "Performing backward journal recovery on OpenVista databases..." |
3384 | - elif function_exists "log_daemon_msg"; then |
3385 | - log_daemon_msg "Performing backward journal recovery on OpenVista databases" |
3386 | - fi |
3387 | - |
3388 | - for instance in `list_openvista_instances`; do |
3389 | - if function_exists "action"; then |
3390 | - action $" Performing recovery on $instance database: " recover_backward "$instance" |
3391 | - elif function_exists "log_daemon_msg"; then |
3392 | - log_progress_msg "$instance" |
3393 | - recover_backward "$instance" || end_msg=1 |
3394 | - else |
3395 | - recover_backward "$instance" |
3396 | - fi |
3397 | - done |
3398 | - |
3399 | - if function_exists "log_daemon_msg"; then |
3400 | - log_end_msg ${end_msg:-0} |
3401 | - fi |
3402 | + instance_function=recover_backward |
3403 | + if function_exists "action"; then |
3404 | + # CentOS/RHEL |
3405 | + touch /var/lock/subsys/openvista-databases \ |
3406 | + 2>&1 | log -lp |
3407 | + ov_init_action_rhel "$instance_function" \ |
3408 | + "Performing recovery if needed on OpenVista databases" \ |
3409 | + "Performing recovery if needed on {instance} database" \ |
3410 | + "$instance" |
3411 | + elif function_exists "log_daemon_msg"; then |
3412 | + # Ubuntu/Debian |
3413 | + ov_init_action_debian "$instance_function" \ |
3414 | + "Performing recovery if needed on OpenVista databases" \ |
3415 | + "Performing recovery if needed on OpenVista database" \ |
3416 | + "$instance" |
3417 | else |
3418 | - if function_exists "action"; then |
3419 | - action $"Performing recovery on $instance database: " recover_backward "$instance" |
3420 | - elif function_exists "log_daemon_msg"; then |
3421 | - log_daemon_msg "Performing backward journal recovery on OpenVista databases" "$instance" |
3422 | - recover_backward "$instance" |
3423 | - log_end_msg $? |
3424 | - else |
3425 | - recover_backward "$instance" |
3426 | - fi |
3427 | + # other |
3428 | + ov_init_action_other "$instance_function" "$instance" |
3429 | fi |
3430 | ;; |
3431 | stop) |
3432 | - if [ -z "$2" ]; then |
3433 | - if function_exists "action"; then |
3434 | - echo "Terminating remaining mumps processes..." |
3435 | - elif function_exists "log_daemon_msg"; then |
3436 | - log_daemon_msg "Terminating remaining mumps processes" |
3437 | - fi |
3438 | - |
3439 | - for instance in `list_openvista_instances`; do |
3440 | - if function_exists "action"; then |
3441 | - action $" Terminating mumps processes in $instance: " terminate_processes "$instance" |
3442 | - elif function_exists "log_daemon_msg"; then |
3443 | - log_progress_msg "$instance" |
3444 | - terminate_processes "$instance" || end_msg=1 |
3445 | - else |
3446 | - terminate_processes "$instance" |
3447 | - fi |
3448 | - done |
3449 | - |
3450 | - if function_exists "log_daemon_msg"; then |
3451 | - log_end_msg ${end_msg:-0} |
3452 | - fi |
3453 | + instance_function=terminate_processes |
3454 | + if function_exists "action"; then |
3455 | + # CentOS/RHEL |
3456 | + [[ "$instance" ]] || rm -f /var/lock/subsys/openvista-databases \ |
3457 | + 2>&1 | log -lp |
3458 | + ov_init_action_rhel "$instance_function" \ |
3459 | + "Terminating remaining OpenVista processes" \ |
3460 | + "Terminating OpenVista processes in {instance}" \ |
3461 | + "$instance" |
3462 | + elif function_exists "log_daemon_msg"; then |
3463 | + # Ubuntu/Debian |
3464 | + ov_init_action_debian "$instance_function" \ |
3465 | + "Terminating remaining OpenVista processes" \ |
3466 | + "Terminating remaining OpenVista processes" \ |
3467 | + "$instance" |
3468 | else |
3469 | - if function_exists "action"; then |
3470 | - action $"Terminating mumps processes in $instance: " terminate_processes "$instance" |
3471 | - elif function_exists "log_daemon_msg"; then |
3472 | - log_daemon_msg "Terminating remaining mumps processes" "$instance" |
3473 | - terminate_processes "$instance" |
3474 | - log_end_msg $? |
3475 | - else |
3476 | - terminate_processes "$instance" |
3477 | - fi |
3478 | + # other |
3479 | + ov_init_action_other "$instance_function" "$instance" |
3480 | fi |
3481 | ;; |
3482 | restart|force-reload) |
3483 | @@ -241,12 +427,11 @@ |
3484 | ;; |
3485 | status) |
3486 | # print usage info for humans, but fake success for RHCS |
3487 | - echo "Usage: openvista-databases {start|stop|restart|force-reload} [INSTANCE_NAME]" |
3488 | + usage |
3489 | exit 0 # LSB: program is running or service is OK |
3490 | ;; |
3491 | *) |
3492 | - echo "Usage: openvista-databases {start|stop|restart|force-reload} [INSTANCE_NAME]" >&2 |
3493 | + usage >&2 |
3494 | exit 2 # LSB: invalid or excess argument(s) |
3495 | ;; |
3496 | esac |
3497 | - |
3498 | |
3499 | === added file 'scripts/etc/init.d/openvista-init' |
3500 | --- scripts/etc/init.d/openvista-init 1970-01-01 00:00:00 +0000 |
3501 | +++ scripts/etc/init.d/openvista-init 2011-08-22 16:52:24 +0000 |
3502 | @@ -0,0 +1,171 @@ |
3503 | +#!/bin/bash |
3504 | + |
3505 | +# Startup/shutdown script for OpenVista Server |
3506 | +# |
3507 | +# chkconfig: - 98 01 |
3508 | +# description: Replication startup/shutdown script for OpenVista Server |
3509 | +# |
3510 | +### BEGIN INIT INFO |
3511 | +# Provides: openvista-init |
3512 | +# Required-Start: openvista-databases openvista-replication |
3513 | +# Required-Stop: openvista-databases openvista-replication |
3514 | +# Default-Start: 2 3 4 5 |
3515 | +# Default-Stop: 0 1 6 |
3516 | +# Short-Description: Replication startup/shutdown script for OpenVista Server |
3517 | +### END INIT INFO |
3518 | + |
3519 | + |
3520 | +# Copyright (C) 2010 Medsphere Systems Corporation |
3521 | +# |
3522 | +# This program is free software; you can redistribute it and/or modify it solely |
3523 | +# under the terms of the GNU Affero General Public License version 3 as published |
3524 | +# by the Free Software Foundation. |
3525 | +# |
3526 | +# This program is distributed in the hope that it will be useful, but WITHOUT |
3527 | +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
3528 | +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License |
3529 | +# for more details. |
3530 | +# |
3531 | +# You should have received a copy of the GNU Affero General Public License |
3532 | +# along with this program. If not, see <http://www.gnu.org/licenses>. |
3533 | +# |
3534 | +# You can contact Medsphere Systems Corporation headquarters at 1917 Palomar |
3535 | +# Oaks Way, Suite 200, Carlsbad, CA 92008 or at legal@medsphere.com. |
3536 | + |
3537 | + |
3538 | +# Check the package is still installed. Traditionally, the test is for a |
3539 | +# program that is executed later in this script, but it's not trivial to find |
3540 | +# the location of the mupip binary because multiple verisons could be |
3541 | +# installed, so look for the functions script instead. |
3542 | +# |
3543 | +# Note that exiting 0 here is against LSB, but Debian policy and LSB conflict |
3544 | +# here, so we have to pick one. |
3545 | +[[ -f /usr/lib/openvista/functions ]] || exit 0 |
3546 | + |
3547 | +# source function libraries |
3548 | +# CentOS/RHEL, provides action(), status() |
3549 | +[[ -f /etc/rc.d/init.d/functions ]] && . /etc/rc.d/init.d/functions |
3550 | +# Ubuntu/Debian, provides log_daemon_msg(), status_of_proc() |
3551 | +[[ -f /lib/lsb/init-functions ]] && . /lib/lsb/init-functions |
3552 | +# OpenVista |
3553 | +. /usr/lib/openvista/functions |
3554 | + |
3555 | +log_command_usage "$@" |
3556 | + |
3557 | +usage() |
3558 | +{ |
3559 | + # Display usage information. |
3560 | + cat <<EOF |
3561 | +Usage: openvista-init {start|stop|restart|force-reload} |
3562 | +EOF |
3563 | +} |
3564 | + |
3565 | +call_scripts() |
3566 | +{ |
3567 | + # Call all of the scripts for the replication mode |
3568 | + local action=$1 |
3569 | + local replication_mode=$2 |
3570 | + log -l "replication mode is '$replication_mode'" |
3571 | + if ! is_in_array "$replication_mode" primary secondary; then |
3572 | + log -srlc \ |
3573 | + "Replication mode is not exclusively primary or secondary, so" \ |
3574 | + "neither set of startup scripts will be run" |
3575 | + return 1 |
3576 | + fi |
3577 | + local script_dir=/etc/openvista/${replication_mode}.d |
3578 | + # If support for dependency is added, this is where it should be added. |
3579 | + # The loop below can be replaced with a single call to a command that |
3580 | + # recursively calls itself on each script as the dependencies are satisfied. |
3581 | + local old_IFS=$IFS |
3582 | + IFS=$'\n' |
3583 | + local files=( $(find -L \ |
3584 | + "$script_dir" \ |
3585 | + -maxdepth 1 \ |
3586 | + -type f \ |
3587 | + ! -name \.\* \ |
3588 | + ! -name *~) ) |
3589 | + IFS=$old_IFS |
3590 | + local file |
3591 | + for file in "${files[@]}"; do |
3592 | + if ! [[ -x "$file" ]]; then |
3593 | + log -l "file '$file' is not executable" |
3594 | + continue |
3595 | + fi |
3596 | + # check for a lock file as used with CentOS/RHEL |
3597 | + if [[ -d /var/lock/subsys ]]; then |
3598 | + local script=$(basename "$file") |
3599 | + local lock_file=/var/lock/subsys/"$script" |
3600 | + if [[ "$action" == "start" ]] && [[ -f "$lock_file" ]]; then |
3601 | + log -l "$script is already started" |
3602 | + continue |
3603 | + elif [[ "$action" == "stop" ]] && ! [[ -f "$lock_file" ]]; then |
3604 | + log -l "$script is already stopped" |
3605 | + continue |
3606 | + fi |
3607 | + fi |
3608 | + log -l "Executing '$file' $action" |
3609 | + "$file" "$action" | sed '' & |
3610 | + done |
3611 | + |
3612 | + log -l "Finished calling $replication_mode scripts with '$action'" |
3613 | + |
3614 | + # wait for the backgrounded scripts to complete |
3615 | + wait |
3616 | + log -sn "...all OpenVista $replication_mode scripts have completed." |
3617 | + |
3618 | + log -l "$replication_mode scripts completed" |
3619 | + |
3620 | + return 0 |
3621 | +} |
3622 | + |
3623 | +# check that user is root |
3624 | +[[ $(id -u) == 0 ]] || exit_command 4 "Must be run as root" |
3625 | +replication_mode=$(get_server_mode) |
3626 | + |
3627 | +case $1 in |
3628 | + start|stop) |
3629 | + action=$1 |
3630 | + message="Calling OpenVista $replication_mode scripts with '$action'" |
3631 | + message+="..."$'\n' |
3632 | + cmd_args=( call_scripts "$action" "$replication_mode") |
3633 | + if function_exists "action"; then |
3634 | + # CentOS/RHEL |
3635 | + # The CentOS/RHEL subsys lock is set and cleared independently of |
3636 | + # the return code, because a partial failure of one action should |
3637 | + # not cause the other to be skipped. |
3638 | + case $action in |
3639 | + start) |
3640 | + touch /var/lock/subsys/openvista-init \ |
3641 | + 2>&1 | log -lp |
3642 | + ;; |
3643 | + stop) |
3644 | + rm -f /var/lock/subsys/openvista-init \ |
3645 | + 2>&1 | log -lp |
3646 | + ;; |
3647 | + esac |
3648 | + action "$message" "${cmd_args[@]}" |
3649 | + elif function_exists "log_daemon_msg"; then |
3650 | + # Ubuntu/Debian |
3651 | + log_daemon_msg "$message" |
3652 | + "${cmd_args[@]}" |
3653 | + retval=$? |
3654 | + log_end_msg "$retval" |
3655 | + exit "$retval" |
3656 | + else |
3657 | + # other |
3658 | + "${cmd_args[@]}" |
3659 | + fi |
3660 | + ;; |
3661 | + restart|force-reload) |
3662 | + $0 stop |
3663 | + $0 start |
3664 | + ;; |
3665 | + status) |
3666 | + usage |
3667 | + exit 0 |
3668 | + ;; |
3669 | + *) |
3670 | + usage >&2 |
3671 | + exit 2 # LSB: invalid or excess argument(s) |
3672 | + ;; |
3673 | +esac |
3674 | |
3675 | === added file 'scripts/etc/init.d/openvista-replication' |
3676 | --- scripts/etc/init.d/openvista-replication 1970-01-01 00:00:00 +0000 |
3677 | +++ scripts/etc/init.d/openvista-replication 2011-08-22 16:52:24 +0000 |
3678 | @@ -0,0 +1,850 @@ |
3679 | +#!/bin/bash |
3680 | + |
3681 | +# Replication startup/shutdown script for OpenVista Server |
3682 | +# |
3683 | +# chkconfig: - 56 31 |
3684 | +# description: Replication startup/shutdown script for OpenVista Server |
3685 | +# |
3686 | +### BEGIN INIT INFO |
3687 | +# Provides: openvista-replication |
3688 | +# Required-Start: openvista-databases sshd |
3689 | +# Required-Stop: |
3690 | +# Default-Start: 2 3 4 5 |
3691 | +# Default-Stop: 0 1 6 |
3692 | +# Short-Description: Replication startup/shutdown script for OpenVista Server |
3693 | +### END INIT INFO |
3694 | + |
3695 | + |
3696 | +# Copyright (C) 2010 Medsphere Systems Corporation |
3697 | +# |
3698 | +# This program is free software; you can redistribute it and/or modify it solely |
3699 | +# under the terms of the GNU Affero General Public License version 3 as published |
3700 | +# by the Free Software Foundation. |
3701 | +# |
3702 | +# This program is distributed in the hope that it will be useful, but WITHOUT |
3703 | +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
3704 | +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License |
3705 | +# for more details. |
3706 | +# |
3707 | +# You should have received a copy of the GNU Affero General Public License |
3708 | +# along with this program. If not, see <http://www.gnu.org/licenses>. |
3709 | +# |
3710 | +# You can contact Medsphere Systems Corporation headquarters at 1917 Palomar |
3711 | +# Oaks Way, Suite 200, Carlsbad, CA 92008 or at legal@medsphere.com. |
3712 | + |
3713 | + |
3714 | +# Check the package is still installed. Traditionally, the test is for a |
3715 | +# program that is executed later in this script, but it's not trivial to find |
3716 | +# the location of the mupip binary because multiple verisons could be |
3717 | +# installed, so look for the functions script instead. |
3718 | +# |
3719 | +# Note that exiting 0 here is against LSB, but Debian policy and LSB conflict |
3720 | +# here, so we have to pick one. |
3721 | +[[ -f /usr/lib/openvista/functions ]] || exit 0 |
3722 | + |
3723 | +# source function libraries |
3724 | +# CentOS/RHEL, provides action(), status() |
3725 | +[[ -f /etc/rc.d/init.d/functions ]] && . /etc/rc.d/init.d/functions |
3726 | +# Ubuntu/Debian, provides log_daemon_msg(), status_of_proc() |
3727 | +[[ -f /lib/lsb/init-functions ]] && . /lib/lsb/init-functions |
3728 | +# OpenVista |
3729 | +. /usr/lib/openvista/functions |
3730 | + |
3731 | +log_command_usage "$@" |
3732 | + |
3733 | +usage() |
3734 | +{ |
3735 | + # Display usage information. |
3736 | + cat <<EOF |
3737 | +Usage: openvista-replication {start|stop|restart|force-reload} [INSTANCE_NAME] |
3738 | + or openvista-replication {status} [INSTANCE_NAME [DAEMON_NAME]] |
3739 | +EOF |
3740 | +} |
3741 | + |
3742 | +start_servers() |
3743 | +{ |
3744 | + set_gtm_env -v "$1" || return $? |
3745 | + |
3746 | + umask 007 |
3747 | + |
3748 | + log -l "Starting replication for $instance" |
3749 | + |
3750 | + case $replication_mode in |
3751 | + primary) |
3752 | + # source the replication configuration file for |
3753 | + # replication_ip, mupip_port, instsecondary |
3754 | + . "$root/$instance/etc/replication.conf" |
3755 | + |
3756 | + log -l "Replication mode is '$replication_mode'" |
3757 | + |
3758 | + ## globals |
3759 | + log -lc "Starting active source server for $instance connecting" \ |
3760 | + "to secondary $replication_ip:$mupip_port" \ |
3761 | + "[$instsecondary]" |
3762 | + |
3763 | + # run mupip as the openvista user |
3764 | + # redirect stdin from /dev/null to avoid ssh hanging on remote calls |
3765 | + mupip_output=$( \ |
3766 | + su -m -c "mupip replicate -source -start \ |
3767 | + -secondary=$replication_ip:$mupip_port \ |
3768 | + -log=\"$root/$instance/replication/source-active.log\" \ |
3769 | + -buffsize=1 -instsecondary=$instsecondary" "$user" \ |
3770 | + < /dev/null 2>&1 \ |
3771 | + | grep -v "^$" \ |
3772 | + | log -slp \ |
3773 | + ) |
3774 | + retval=${PIPESTATUS[0]} |
3775 | + |
3776 | + # if received error: |
3777 | + # %GTM-E-REPLREQRUNDOWN, Error accessing replication instance |
3778 | + # opt/openvista/open/replication/repl_instance. Must be rundown |
3779 | + # on cluster node vm1. |
3780 | + # %SYSTEM-E-ENO22, Invalid argument |
3781 | + if echo "$mupip_output" \ |
3782 | + | grep "GTM-E-REPLREQRUNDOWN" >/dev/null; then |
3783 | + |
3784 | + log -lc "While starting primary active source server for" \ |
3785 | + "\"$instance\" openvista-replication received" \ |
3786 | + "GTM-E-REPLREQRUNDOWN from mupip, so it will" \ |
3787 | + "rundown \"$instance\", perform a journal rollback," \ |
3788 | + "and then start the source server" |
3789 | + |
3790 | + log -l "Running mupip rundown on \"$instance\"" |
3791 | + mupip rundown -region "*" \ |
3792 | + < /dev/null 2>&1 \ |
3793 | + | grep -v "^$" \ |
3794 | + | log -lp |
3795 | + |
3796 | + # after mupip rundown, will still give error: |
3797 | + # %GTM-E-REPLREQROLLBACK, Replication instance file |
3798 | + # opt/openvista/open/replication/repl_instance indicates |
3799 | + # abnormal shutdown. Run MUPIP JOURNAL ROLLBACK first |
3800 | + log -l "Running mupip journal rollback on \"$instance\"" |
3801 | + mupip journal -rollback -backward "*" \ |
3802 | + < /dev/null 2>&1 \ |
3803 | + | grep -v "^$" \ |
3804 | + | log -lp |
3805 | + |
3806 | + log -lc "Starting active source server for $instance" \ |
3807 | + "connecting to secondary $replication_ip:$mupip_port" \ |
3808 | + "[$instsecondary]" |
3809 | + su -m -c "mupip replicate -source -start \ |
3810 | + -secondary=$replication_ip:$mupip_port \ |
3811 | + -log=\"$root/$instance/replication/source-active.log\" \ |
3812 | + -buffsize=1 -instsecondary=$instsecondary" "$user" \ |
3813 | + < /dev/null 2>&1 \ |
3814 | + | grep -v "^$" \ |
3815 | + | log -lp |
3816 | + # this updates the retval set above in the original call |
3817 | + retval=${PIPESTATUS[0]} |
3818 | + fi |
3819 | + |
3820 | + server_status=$({ mupip replic -source -checkhealth 1>/dev/null; } \ |
3821 | + 2>&1 | grep PID) |
3822 | + : ${server_status:="Source server is not started"} |
3823 | + log -l "OpenVista instance $instance: $server_status" |
3824 | + |
3825 | + pid=$(echo "$server_status" \ |
3826 | + | sed -rn "s/^PID ([0-9]+) Source.*alive.*ACTIVE.*$/\1/p") |
3827 | + if [[ "$pid" ]]; then |
3828 | + # write PID file for the source server |
3829 | + echo "$pid" > "$root/$instance/replication/source-active.pid" |
3830 | + |
3831 | + # restart the remote receiver if it is alive but not connecting |
3832 | + # If the primary server is powered off without the normal |
3833 | + # shutdown of the mupip processes and is then rebooted, the |
3834 | + # receiver server can still hold the old connection and will |
3835 | + # then refuse the new connection from the source server. |
3836 | + # If this happens, both source and receiver will both show as |
3837 | + # running, but will never connect, and replication will fail. |
3838 | + old_IFS=$IFS |
3839 | + IFS=$'\n' |
3840 | + remote_status=( \ |
3841 | + $(sshk "$replication_ip" \ |
3842 | + /usr/sbin/ovinstancerepl -s status \ |
3843 | + "$other_instance") ) |
3844 | + IFS=$old_IFS |
3845 | + if array_lookup -d '=' "GT.M receiver server" \ |
3846 | + "${remote_status[@]}" \ |
3847 | + | grep "PID" >/dev/null; then |
3848 | + log -lc "instance $instance:" \ |
3849 | + "the receiver server is running on the secondary" |
3850 | + # The receiver server is running on the secondary, so |
3851 | + # the primary source server should be able to connect. |
3852 | + unset mupip_connected |
3853 | + allowed_delay=5 |
3854 | + for (( time_left=$allowed_delay; \ |
3855 | + time_left!=0; time_left-- )); do |
3856 | + if lsof -c mupip -i :"$mupip_port" -a \ |
3857 | + | grep "ESTABLISHED" >/dev/null; then |
3858 | + # The source server has connected. |
3859 | + mupip_connected=true |
3860 | + log -lc "instance $instance: the source server" \ |
3861 | + "has connected to the receiver server" |
3862 | + break |
3863 | + fi |
3864 | + sleep 1 |
3865 | + done |
3866 | + : ${mupip_connected:=false} |
3867 | + |
3868 | + if ! $mupip_connected; then |
3869 | + log -lc "instance $instance: the source server" \ |
3870 | + "has failed to connect to the receiver server" |
3871 | + # The primary source server has failed to connect even |
3872 | + # though the receiver server is running, so the receiver |
3873 | + # server is probably holding on to an old connection and |
3874 | + # needs to be restarted for it to listen for a new one. |
3875 | + log -lc "instance $instance: restarting the remote" \ |
3876 | + "receiver server" |
3877 | + sshk "$replication_ip" \ |
3878 | + /etc/init.d/openvista-replication \ |
3879 | + restart "$other_instance" || retval=1 |
3880 | + # The secondary instance may still need to be resynced |
3881 | + # (by a system administrator) using `ovinstancerepl |
3882 | + # resync` to re-establish replication. |
3883 | + #TODO: check if the restart fixed it and log the result |
3884 | + fi |
3885 | + else |
3886 | + log -lc "instance $instance: the receiver server is not" \ |
3887 | + "running on the secondary" |
3888 | + fi |
3889 | + fi |
3890 | + |
3891 | + ## routines and WebDAV |
3892 | + |
3893 | + # Stop lsyncd if it is already running. |
3894 | + stop_lsyncd |
3895 | + |
3896 | + set_apache_vars |
3897 | + /usr/sbin/ovgenconfig -s "replication" $instance "lsyncd.conf.xml" \ |
3898 | + "ROOT=$root" \ |
3899 | + "INSTANCE=$instance" \ |
3900 | + "REPLICATION_IP=$replication_ip" \ |
3901 | + "RSYNC_PORT=$rsync_port" \ |
3902 | + "DOCROOT=$docroot" \ |
3903 | + 2>&1 | log -lp |
3904 | + if [[ "${PIPESTATUS[0]}" == 0 ]]; then |
3905 | + start_lsyncd || retval=1 |
3906 | + else |
3907 | + log -l "Unable to configure lsyncd for $instance" |
3908 | + retval=1 |
3909 | + fi |
3910 | + |
3911 | + return "$retval" |
3912 | + ;; |
3913 | + secondary) |
3914 | + # source the replication configuration file for |
3915 | + # mupip_port, instsecondary |
3916 | + . "$root/$instance/etc/replication.conf" |
3917 | + |
3918 | + log -l "Replication mode is '$replication_mode'" |
3919 | + |
3920 | + ## globals |
3921 | + log -lc "Attempting journal fetchresync for $instance on port" \ |
3922 | + "$mupip_port" |
3923 | + |
3924 | + # The 'fetchresync' option is primarily for the case of the |
3925 | + # secondary being brought up for the first time after having being |
3926 | + # switched over from being the primary. |
3927 | + # If the secondary is a former primary, it may have transactions |
3928 | + # from prior to failover that were never replicated. The |
3929 | + # fetchresync option will rollback to the last replicated |
3930 | + # transaction and write the unreplicated transactions to the |
3931 | + # fetchresync_[timestamp].lost file. |
3932 | + # See http://mirrors.medsphere.org/pub/tinco.pair.com/bhaskar/gtm/doc/books/ao/UNIX_manual/ch07s03.html#rollback_db_after_sys_fail |
3933 | + # http://mirrors.medsphere.org/pub/tinco.pair.com/bhaskar/gtm/doc/articles/GTM_Multi_Site_Replication.html#id881700 |
3934 | + # http://mirrors.medsphere.org/pub/tinco.pair.com/bhaskar/gtm/doc/articles/GTM_Multi_Site_Replication.html#id882869 |
3935 | + # "Any instance coming up as secondary must do a mupip journal |
3936 | + # –rollback –fetchresync with the current primary, |
3937 | + # regardless of whether it was previously a secondary or |
3938 | + # primary. Not doing this could cause errors (secondary ahead |
3939 | + # of primary etc.) during receiver server startup." |
3940 | + # For processing the lost transactions file, see |
3941 | + # http://mirrors.medsphere.org/pub/tinco.pair.com/bhaskar/gtm/doc/articles/GTM_Multi_Site_Replication.html#id882796 |
3942 | + # Since this script does not know whether the secondary is a former |
3943 | + # primary, it will try the fetchresync just in case. |
3944 | + # If the secondary is not a former primary, the fetchresync may |
3945 | + # fail, harmlessly. So the script does not exit on this error. |
3946 | + timestamp=$(date +%Y%m%d-%H%M%S) |
3947 | + filename="fetchresync_$timestamp.lost" |
3948 | + mupip journal -rollback -fetchresync=$mupip_port \ |
3949 | + -losttrans="$root/$instance/replication/$filename" \ |
3950 | + -backward '*' 2>&1 \ |
3951 | + | grep -v '^$' \ |
3952 | + | log -lp |
3953 | + retval=${PIPESTATUS[0]} |
3954 | + [[ "$retval" == 0 ]] \ |
3955 | + || log -lc "Journal fetchresync for $instance failed, but this" \ |
3956 | + "is normal unless this secondary instance is a" \ |
3957 | + "former primary that is now starting as a secondary" \ |
3958 | + "for the first time" |
3959 | + |
3960 | + log -lc "Starting passive source server for $instance" \ |
3961 | + "connecting to primary $replication_ip:$mupip_port" \ |
3962 | + "[$instsecondary]" |
3963 | + |
3964 | + # run mupip as the openvista user |
3965 | + # redirect stdin from /dev/null to avoid ssh hanging on remote calls |
3966 | + mupip_output=$( \ |
3967 | + su -m -c "mupip replicate -source -start -passive \ |
3968 | + -log=\"$root/$instance/replication/source-passive.log\" \ |
3969 | + -buffsize=1 -instsecondary=$instsecondary" "$user" \ |
3970 | + < /dev/null 2>&1 \ |
3971 | + | grep -v '^$' \ |
3972 | + | log -slp \ |
3973 | + ) |
3974 | + retval=${PIPESTATUS[0]} |
3975 | + |
3976 | + if echo "$mupip_output" \ |
3977 | + | grep "GTM-E-REPLREQROLLBACK" >/dev/null; then |
3978 | + # "%GTM-E-REPLREQROLLBACK, Replication instance file |
3979 | + # /opt/openvista/[instance]/replication/repl_instance indicates |
3980 | + # abnormal shutdown. Run MUPIP JOURNAL ROLLBACK first" |
3981 | + |
3982 | + log -lc "While starting secondary passive source server for" \ |
3983 | + "\"$instance\" openvista-replication received" \ |
3984 | + "GTM-E-REPLREQROLLBACK from mupip, so it will" \ |
3985 | + "perform a journal rollback on \"$instance\"," \ |
3986 | + "and then start the source server" |
3987 | + |
3988 | + log -l "Running mupip journal rollback on \"$instance\"" |
3989 | + mupip journal -rollback -backward "*" \ |
3990 | + < /dev/null 2>&1 \ |
3991 | + | grep -v "^$" \ |
3992 | + | log -lp |
3993 | + |
3994 | + log -lc "Starting secondary source server for $instance" \ |
3995 | + "connecting to primary $replication_ip:$mupip_port" \ |
3996 | + "[$instsecondary]" |
3997 | + su -m -c "mupip replicate -source -start -passive \ |
3998 | + -log=\"$root/$instance/replication/source-passive.log\" \ |
3999 | + -buffsize=1 -instsecondary=$instsecondary" "$user" \ |
4000 | + < /dev/null 2>&1 \ |
4001 | + | grep -v "^$" \ |
4002 | + | log -lp |
4003 | + # this updates the retval set above in the original call |
4004 | + retval=${PIPESTATUS[0]} |
4005 | + elif echo "$mupip_output" \ |
4006 | + | grep "GTM-E-SRCSRVEXISTS" >/dev/null; then |
4007 | + # "%GTM-E-SRCSRVEXISTS, Source server for secondary instance ___ |
4008 | + # is already running with pid ___" |
4009 | + retval=0 |
4010 | + fi |
4011 | + |
4012 | + mupip_health=$({ mupip replicate -source -checkhealth \ |
4013 | + 1>/dev/null; } 2>&1) |
4014 | + |
4015 | + server_status=$(echo "$mupip_health" | grep "Source server") |
4016 | + : ${server_status:="Source server is not started"} |
4017 | + log -l "OpenVista instance $instance: $server_status" |
4018 | + |
4019 | + # write PID file for the source server |
4020 | + pid=$(echo "$server_status" \ |
4021 | + | sed -rn "s/^PID ([0-9]+) Source.*alive.*PASSIVE.*$/\1/p") |
4022 | + if [[ "$pid" ]]; then |
4023 | + echo "$pid" > "$root/$instance/replication/source-passive.pid" |
4024 | + fi |
4025 | + |
4026 | + [[ "$retval" == 0 ]] || return 1 |
4027 | + |
4028 | + log -l "Starting receiver server for $instance on port $mupip_port" |
4029 | + |
4030 | + # run mupip as the openvista user |
4031 | + # redirect stdin from /dev/null to avoid ssh hanging on remote calls |
4032 | + su -m -c "mupip replicate -receiver -start -listenport=$mupip_port \ |
4033 | + -log=\"$root/$instance/replication/receiver.log\" \ |
4034 | + -buffsize=1 -updateresync" "$user" < /dev/null 2>&1 \ |
4035 | + | grep -v '^$' \ |
4036 | + | log -slp |
4037 | + retval=${PIPESTATUS[0]} |
4038 | + |
4039 | + mupip_health=$({ mupip replicate -receiver -checkhealth \ |
4040 | + 1>/dev/null; } 2>&1) |
4041 | + |
4042 | + server_status=$(echo "$mupip_health" | grep "Receiver server") |
4043 | + : ${server_status:="Receiver server is not started"} |
4044 | + log -l "OpenVista instance $instance: $server_status" |
4045 | + |
4046 | + # write PID file for the receiver server |
4047 | + pid=$(echo "$server_status" \ |
4048 | + | sed -rn "s/^PID ([0-9]+) Receiver.*alive.*$/\1/p") |
4049 | + if [[ "$pid" ]]; then |
4050 | + echo "$pid" > "$root/$instance/replication/receiver.pid" |
4051 | + fi |
4052 | + |
4053 | + server_status=$(echo "$mupip_health" | grep "Update process") |
4054 | + : ${server_status:="Update process is not started"} |
4055 | + log -l "OpenVista instance $instance: $server_status" |
4056 | + |
4057 | + # write PID file for the update process |
4058 | + pid=$(echo "$server_status" \ |
4059 | + | sed -rn "s/^PID ([0-9]+) Update.*alive.*$/\1/p") |
4060 | + if [[ "$pid" ]]; then |
4061 | + echo "$pid" > "$root/$instance/replication/update.pid" |
4062 | + fi |
4063 | + |
4064 | + ## routines and WebDAV |
4065 | + log -lc "Starting daemon for replication of routines and WebDAV" \ |
4066 | + "for $instance" |
4067 | + |
4068 | + # Stop rsyncd if it is already running. |
4069 | + if ! stop_rsyncd; then |
4070 | + log -l "instance $instance: failed to stop rsyncd" |
4071 | + retval=1 |
4072 | + fi |
4073 | + |
4074 | + set_apache_vars |
4075 | + /usr/sbin/ovgenconfig -s "replication" $instance "rsyncd.conf" \ |
4076 | + "ROOT=$root" \ |
4077 | + "INSTANCE=$instance" \ |
4078 | + "RSYNC_PORT=$rsync_port" \ |
4079 | + "BIND_ADDRESS=$bind_address" \ |
4080 | + "USER=$user" \ |
4081 | + "DOCROOT=$docroot" \ |
4082 | + "APACHE_USER=$apache_user" \ |
4083 | + 2>&1 | log -lp |
4084 | + if [[ "${PIPESTATUS[0]}" == 0 ]]; then |
4085 | + if ! start_rsyncd; then |
4086 | + log -l "instance $instance: failed to start rsyncd" |
4087 | + retval=1 |
4088 | + fi |
4089 | + log -l \ |
4090 | + "Restarting lsyncd on primary server at $replication_ip" |
4091 | + sshk $replication_ip /etc/init.d/openvista-replication \ |
4092 | + restart_lsyncd $other_instance || retval=1 |
4093 | + else |
4094 | + log -l "Unable to configure rsyncd for $instance" |
4095 | + retval=1 |
4096 | + fi |
4097 | + ;; |
4098 | + *) |
4099 | + log -lc "Replication mode is neither 'primary' nor 'secondary'," \ |
4100 | + "skipping replication server startup" |
4101 | + ;; |
4102 | + esac |
4103 | + |
4104 | + return "$retval" |
4105 | +} |
4106 | + |
4107 | +stop_servers() |
4108 | +{ |
4109 | + set_gtm_env -v "$1" || return $? |
4110 | + |
4111 | + # At this point, the replication.conf file may have been reconfigured since |
4112 | + # starting the servers, so this function just shuts down whatever GT.M |
4113 | + # replication processes are running for the instance without checking the |
4114 | + # replication mode. |
4115 | + |
4116 | + # A -timeout parameter may be specified for the shutdowns: |
4117 | + # http://tinco.pair.com/bhaskar/gtm/doc/books/ao/UNIX_manual/ch07s03.html#cntrl_repl |
4118 | + # |
4119 | + # -timeout=<timeout in seconds> |
4120 | + # Use this optional qualifier to specify the period of time the |
4121 | + # server should wait before shutting down. If you do not specify a |
4122 | + # qualifier, the default timeout period is 30 seconds. If you |
4123 | + # specify -timeout=0 , shutdown occurs immediately. |
4124 | + |
4125 | + # shut down receiver server if it is running |
4126 | + server_status=$(mupip replic -receiver -checkhealth 2>&1 1>/dev/null \ |
4127 | + | grep "PID") |
4128 | + if [[ "$server_status" ]]; then |
4129 | + log -l "For $instance instance: $server_status" \ |
4130 | + "Shutting down receiver server for $instance" |
4131 | + mupip replicate -receiver -shutdown -timeout=5 2>&1 \ |
4132 | + | grep -v '^$' \ |
4133 | + | log -lp |
4134 | + rm -f "$root/$instance/replication/receiver.pid" |
4135 | + rm -f "$root/$instance/replication/update.pid" |
4136 | + else |
4137 | + log -l "No receiver server is running for $instance" |
4138 | + fi |
4139 | + |
4140 | + # shut down source server if it is running |
4141 | + server_status=$(mupip replic -source -checkhealth 2>&1 1>/dev/null \ |
4142 | + | grep "PID") |
4143 | + if [[ "$server_status" ]]; then |
4144 | + # for a primary server, wait for any replication backlog to clear |
4145 | + if echo "$server_status" | grep "ACTIVE" >/dev/null; then |
4146 | + wait_for_gtm_backlog_to_clear "$instance" |
4147 | + fi |
4148 | + |
4149 | + log -l "For $instance instance: $server_status" \ |
4150 | + "Shutting down source server for $instance" |
4151 | + # This server may be active or passive |
4152 | + mupip replicate -source -shutdown -timeout=5 2>&1 \ |
4153 | + | grep -v '^$' \ |
4154 | + | log -lp |
4155 | + rm -f "$root/$instance/replication/source-active.pid" |
4156 | + rm -f "$root/$instance/replication/source-passive.pid" |
4157 | + else |
4158 | + log -l "No source server is running for $instance" |
4159 | + fi |
4160 | + |
4161 | + log -l "Running down database for $instance" |
4162 | + # Database rundown is recommended by FIS documentation: |
4163 | + # http://tinco.pair.com/bhaskar/gtm/doc/articles/GTM_Multi_Site_Replication.html#shut_inst |
4164 | + mupip rundown -region DEFAULT 2>&1 \ |
4165 | + | grep -v '^$' \ |
4166 | + | log -lp |
4167 | + |
4168 | + # Stop replication of routines and WebDAV |
4169 | + stop_lsyncd |
4170 | + stop_rsyncd |
4171 | + |
4172 | + return 0 |
4173 | +} |
4174 | + |
4175 | +wait_for_gtm_backlog_to_clear() |
4176 | +{ |
4177 | + # Allow time for replication backlog to be cleared. |
4178 | + local instance=$1 |
4179 | + |
4180 | + # how many times to give more time if backlog is reduced |
4181 | + local allowed_tries=6 |
4182 | + # seconds to wait for backlog to be zero |
4183 | + local allowed_delay=20 |
4184 | + |
4185 | + local tries_left |
4186 | + local time_left |
4187 | + local mupip_backlog |
4188 | + local initial_repl_backlog |
4189 | + local repl_backlog |
4190 | + local last_written_jnl_seqno |
4191 | + local last_sent_jnl_seqno |
4192 | + for (( tries_left=$allowed_tries; tries_left!=0; tries_left-- )); do |
4193 | + old_IFS=$IFS |
4194 | + IFS=$'\n' |
4195 | + mupip_backlog=( $(mupip_showbacklog "$instance") ) |
4196 | + IFS=$old_IFS |
4197 | + initial_repl_backlog=${mupip_backlog[2]} |
4198 | + [[ "$initial_repl_backlog" == 0 ]] || log -srlc \ |
4199 | + "There are $initial_repl_backlog journal entries not yet" \ |
4200 | + "replicated to the secondary, will wait up to $allowed_delay" \ |
4201 | + "seconds for them to be replicated" |
4202 | + for (( time_left=$allowed_delay; time_left!=0; time_left-- )); do |
4203 | + old_IFS=$IFS |
4204 | + IFS=$'\n' |
4205 | + mupip_backlog=( $(mupip_showbacklog "$instance") ) |
4206 | + IFS=$old_IFS |
4207 | + |
4208 | + last_written_jnl_seqno=${mupip_backlog[0]} |
4209 | + last_sent_jnl_seqno=${mupip_backlog[1]} |
4210 | + repl_backlog=${mupip_backlog[2]} |
4211 | + |
4212 | + [[ "$repl_backlog" == "0" ]] && break |
4213 | + log -lc \ |
4214 | + "$instance GT.M journal: last written: $last_written_jnl_seqno," \ |
4215 | + "last sent: $last_sent_jnl_seqno, backlog: $initial_repl_backlog" |
4216 | + sleep 1 |
4217 | + done |
4218 | + if [[ "$repl_backlog" == "0" ]]; then |
4219 | + log -l "The $instance database has no GT.M replication backlog" |
4220 | + break |
4221 | + elif (( "$repl_backlog" >= \ |
4222 | + "$initial_repl_backlog" )); then |
4223 | + log -srlc \ |
4224 | + "There are still $repl_backlog journal entries not yet" \ |
4225 | + "replicated to the secondary, but the allowed time of" \ |
4226 | + "$allowed_delay seconds is exceeded" |
4227 | + break |
4228 | + else |
4229 | + log -lc \ |
4230 | + "replication backlog was reduced in the past $allowed_delay" \ |
4231 | + "seconds, will wait another $allowed_delay seconds" |
4232 | + fi |
4233 | + done |
4234 | + |
4235 | + local root=$(get_ov_root) |
4236 | + local backlog_file="$root/$instance/replication/backlog" |
4237 | + if (( "$repl_backlog" == 0 )); then |
4238 | + rm -f "$backlog_file" |
4239 | + return 0 |
4240 | + else |
4241 | + echo "$last_written_jnl_seqno" \ |
4242 | + "$last_sent_jnl_seqno" \ |
4243 | + "$repl_backlog" > "$backlog_file" |
4244 | + return 1 |
4245 | + fi |
4246 | +} |
4247 | + |
4248 | +start_lsyncd() |
4249 | +{ |
4250 | + # lsyncd needs the permissions of both |
4251 | + # 'user' (mysql) and 'apache_user' (www-data) so we run it as root. |
4252 | + # |
4253 | + # lsyncd sends all output to its configured log file, rather than |
4254 | + # stdout/stderr, unless the --no-daemon flag is specified (and it is |
4255 | + # not), so we do not need to redirect output from it. |
4256 | + log -l "Starting lsyncd daemon for $instance" |
4257 | + local conf_file="$root/$instance/replication/lsyncd.conf.xml" |
4258 | + [[ -f "$conf_file" ]] \ |
4259 | + || { log -slr "Error: File \"$conf_file\" is missing" |
4260 | + return 1; } |
4261 | + lsyncd --conf "$conf_file" \ |
4262 | + || { log -slr "Error: Failed to start lsyncd" |
4263 | + return 1; } |
4264 | + return 0 |
4265 | +} |
4266 | + |
4267 | +stop_lsyncd() |
4268 | +{ |
4269 | + wait_for_lsyncd_to_be_caught_up "$instance" |
4270 | + lsyncd_pid_file="$root/$instance/replication/lsyncd.pid" |
4271 | + if pid=$(pidofproc -p "$lsyncd_pid_file" lsyncd); then |
4272 | + # the lsyncd process with that pid exists, kill it |
4273 | + log -l "Stopping lsyncd daemon (pid: $pid) for $instance" |
4274 | + kill_and_verify "$pid" || { log -slr "Error: Failed to stop lsyncd" |
4275 | + return 1; } |
4276 | + rm -f "$lsyncd_pid_file" |
4277 | + fi |
4278 | + return 0 |
4279 | +} |
4280 | + |
4281 | +wait_for_lsyncd_to_be_caught_up() |
4282 | +{ |
4283 | + # Wait, with timeout, for lsyncd replication to be caught up. |
4284 | + # This function allows for a file replication backlog to exist that needs |
4285 | + # time to clear, however, we do not have a reliable way to measure a |
4286 | + # backlog of file replication or even to know truly whether it is |
4287 | + # backlogged. When lsyncd is caught up and waiting for further changes, |
4288 | + # it writes "gone blocking" to its log file. So this function simply |
4289 | + # waits with a timeout for that message to appear at the end of the log. |
4290 | + local instance=$1 |
4291 | + |
4292 | + # seconds to wait for lsyncd to be caught up |
4293 | + local allowed_delay=20 |
4294 | + |
4295 | + local time_left |
4296 | + local caught_up=false |
4297 | + local root=$(get_ov_root) |
4298 | + local log_file=$root/$instance/replication/lsyncd.log |
4299 | + |
4300 | + [[ -f "$log_file" ]] || return |
4301 | + |
4302 | + for (( time_left=$allowed_delay; time_left!=0; time_left-- )); do |
4303 | + if tail -n1 "$log_file" \ |
4304 | + | grep "gone blocking" > /dev/null; then |
4305 | + caught_up=true |
4306 | + break |
4307 | + fi |
4308 | + sleep 1 |
4309 | + done |
4310 | + |
4311 | + local backlog_file="$root/$instance/replication/lsyncd_not_caught_up" |
4312 | + if $caught_up; then |
4313 | + log -l "lsyncd for instance $instance is caught up" |
4314 | + rm -f "$backlog_file" |
4315 | + return 0 |
4316 | + else |
4317 | + log -lc "lsyncd for instance $instance is not caught up after" \ |
4318 | + "$allowed_delay seconds" |
4319 | + echo "tail $log_file" > "$backlog_file" |
4320 | + tail "$log_file" >> "$backlog_file" |
4321 | + return 1 |
4322 | + fi |
4323 | +} |
4324 | + |
4325 | +start_rsyncd() |
4326 | +{ |
4327 | + # rsync needs the permissions of both |
4328 | + # 'user' (mysql) and 'apache_user' (www-data) so we run it as root. |
4329 | + local conf_file="$root/$instance/replication/rsyncd.conf" |
4330 | + [[ -f "$conf_file" ]] \ |
4331 | + || { log -slr "Error: File \"$conf_file\" is missing" |
4332 | + return 1; } |
4333 | + rsync --daemon --config "$conf_file" \ |
4334 | + < /dev/null \ |
4335 | + | grep -v '^$' \ |
4336 | + | log -lp |
4337 | + (( "${PIPESTATUS[0]}" == 0 )) || { log -slr "Error: Failed to start rsync" |
4338 | + return 1; } |
4339 | + return 0 |
4340 | +} |
4341 | + |
4342 | +stop_rsyncd() |
4343 | +{ |
4344 | + rsyncd_pid_file="$root/$instance/replication/rsyncd.pid" |
4345 | + if pid=$(pidofproc -p "$rsyncd_pid_file" rsync); then |
4346 | + # the rsync process with that pid exists, kill it |
4347 | + log -l "Stopping rsync daemon (pid: $pid) for $instance" |
4348 | + kill_and_verify "$pid" || { log -slr "Error: Failed to stop rsyncd" |
4349 | + return 1; } |
4350 | + # rsyncd removes its PID file itself when it is killed |
4351 | + fi |
4352 | + return 0 |
4353 | +} |
4354 | + |
4355 | +is_new_repl_instance() |
4356 | +{ |
4357 | + # Return true (0) if the journal sequence number is 0. |
4358 | + label="HDR Journal Sequence Number" |
4359 | + jnl_seqno=$(mupip replicate -editinstance -show "$gtm_repl_instance" 2>&1 \ |
4360 | + | grep "^$label" | sed -r "s/\[.*//" | sed -r "s/[^0-9]//g") |
4361 | + [[ "$jnl_seqno" == 0 ]] |
4362 | +} |
4363 | + |
4364 | +# check that user is root |
4365 | +[[ $(id -u) == 0 ]] || exit_command 4 "Must be run as root" |
4366 | + |
4367 | +# check for valid arguments |
4368 | +instance=$2 |
4369 | +if [[ "$instance" ]]; then |
4370 | + is_openvista_instance "$instance" || exit_command 2 "$ov_error" |
4371 | + instances=( "$instance" ) |
4372 | + multiple=false |
4373 | +else |
4374 | + instances=( $(list_openvista_instances --primaries_first) ) |
4375 | + multiple=true |
4376 | +fi |
4377 | + |
4378 | +case $1 in |
4379 | + # For 'start' and 'stop', the ov_init_action calls provide the exit value |
4380 | + # for the script. The CentOS/RHEL subsys lock is set and cleared |
4381 | + # independently of the return code, because a partial failure of one action |
4382 | + # should not cause the other to be skipped. The lock is only set or cleared |
4383 | + # when being called without an instance name argument. Any error from |
4384 | + # touching or removing the lock file is hidden from the console so that the |
4385 | + # script can be run without an instance name by a non-root admin without |
4386 | + # printing confusing error messages. |
4387 | + start) |
4388 | + instance_function=start_servers |
4389 | + instance_filter="--primaries_first" |
4390 | + if function_exists "action"; then |
4391 | + # CentOS/RHEL |
4392 | + touch /var/lock/subsys/openvista-replication \ |
4393 | + 2>&1 | log -lp |
4394 | + ov_init_action_rhel "$instance_function" \ |
4395 | + "Starting replication for OpenVista databases" \ |
4396 | + "Starting replication for {instance} database" \ |
4397 | + "$instance" "$instance_filter" |
4398 | + elif function_exists "log_daemon_msg"; then |
4399 | + # Ubuntu/Debian |
4400 | + ov_init_action_debian "$instance_function" \ |
4401 | + "Starting replication for OpenVista databases" \ |
4402 | + "Starting replication for OpenVista database" \ |
4403 | + "$instance" "$instance_filter" |
4404 | + else |
4405 | + # other |
4406 | + ov_init_action_other "$instance_function" "$instance" |
4407 | + fi |
4408 | + ;; |
4409 | + stop) |
4410 | + instance_function=stop_servers |
4411 | + instance_filter="--primaries_first" |
4412 | + if function_exists "action"; then |
4413 | + # CentOS/RHEL |
4414 | + $multiple || rm -f /var/lock/subsys/openvista-replication \ |
4415 | + 2>&1 | log -lp |
4416 | + ov_init_action_rhel "$instance_function" \ |
4417 | + "Stopping replication for OpenVista databases" \ |
4418 | + "Stopping replication for {instance} database" \ |
4419 | + "$instance" "$instance_filter" |
4420 | + elif function_exists "log_daemon_msg"; then |
4421 | + # Ubuntu/Debian |
4422 | + ov_init_action_debian "$instance_function" \ |
4423 | + "Stopping replication for OpenVista databases" \ |
4424 | + "Stopping replication for OpenVista database" \ |
4425 | + "$instance" "$instance_filter" |
4426 | + else |
4427 | + # other |
4428 | + ov_init_action_other "$instance_function" "$instance" |
4429 | + fi |
4430 | + ;; |
4431 | + restart|force-reload) |
4432 | + $0 stop $2 |
4433 | + $0 start $2 |
4434 | + ;; |
4435 | + status) |
4436 | + # tell whether the replication daemons are running |
4437 | + |
4438 | + daemon=$3 |
4439 | + primary_daemon_names=( |
4440 | + source-active |
4441 | + lsyncd |
4442 | + ) |
4443 | + secondary_daemon_names=( |
4444 | + source-passive |
4445 | + receiver |
4446 | + update |
4447 | + rsyncd |
4448 | + ) |
4449 | + if [[ "$daemon" ]]; then |
4450 | + is_in_array "$daemon" "${primary_daemon_names[@]}" \ |
4451 | + "${secondary_daemon_names[@]}" \ |
4452 | + || exit_command 2 "Unrecognized daemon name: $daemon" |
4453 | + fi |
4454 | + |
4455 | + # wrap the appropriate standard status function |
4456 | + if function_exists "status"; then |
4457 | + # CentOS/RHEL /etc/rc.d/init.d/functions status() |
4458 | + daemon_status() |
4459 | + { |
4460 | + local name=$2 |
4461 | + [[ "$3" ]] && name=$3 |
4462 | + status -p "$1" "$name" |
4463 | + } |
4464 | + elif function_exists "status_of_proc"; then |
4465 | + # Ubuntu/Debian /lib/lsb/init-functions status_of_proc() |
4466 | + daemon_status() |
4467 | + { |
4468 | + local pid |
4469 | + local name=$2 |
4470 | + [[ "$3" ]] && name=$3 |
4471 | + pid=$(pidofproc -p "$1" "$2") && name+=" (pid $pid)" |
4472 | + status_of_proc -p "$1" "$2" "$name" |
4473 | + } |
4474 | + fi |
4475 | + |
4476 | + retval=0 |
4477 | + root=$(get_ov_root) |
4478 | + for instance in "${instances[@]}"; do |
4479 | + replication_mode="" |
4480 | + conf_file=$root/$instance/etc/replication.conf |
4481 | + [[ -f "$conf_file" ]] && . "$conf_file" |
4482 | + case $replication_mode in |
4483 | + "primary" | "secondary") |
4484 | + $multiple && echo |
4485 | + $multiple && echo "instance \"$instance\" ($replication_mode):" |
4486 | + if [[ "$daemon" ]]; then |
4487 | + daemon_names=( "$daemon" ) |
4488 | + else |
4489 | + if [[ "$replication_mode" == "primary" ]]; then |
4490 | + daemon_names=( "${primary_daemon_names[@]}" ) |
4491 | + else |
4492 | + daemon_names=( "${secondary_daemon_names[@]}" ) |
4493 | + fi |
4494 | + fi |
4495 | + for name in "${daemon_names[@]}"; do |
4496 | + pid_file="$root/$instance/replication/$name.pid" |
4497 | + $multiple && echo -en "\t" |
4498 | + daemon_status "$pid_file" "$name" || retval=1 |
4499 | + done |
4500 | + ;; |
4501 | + *) |
4502 | + echo "instance \"$instance\" is not replicating" |
4503 | + retval=1 |
4504 | + ;; |
4505 | + esac |
4506 | + done |
4507 | + |
4508 | + exit $retval |
4509 | + ;; |
4510 | + restart_lsyncd) |
4511 | + # restart the lsyncd daemon |
4512 | + # This is called remotely from the secondary after it starts its |
4513 | + # rsyncd daemon so that lsyncd on the primary will connect with the |
4514 | + # new rsyncd daemon. |
4515 | + [[ "$instance" ]] || { |
4516 | + echo "openvista-replication: restart_lsyncd" \ |
4517 | + "requires an instance name" >&2 |
4518 | + exit 2 # LSB: invalid or excess argument(s) |
4519 | + } |
4520 | + stop_lsyncd || exit 1 |
4521 | + start_lsyncd || exit 1 |
4522 | + exit 0 |
4523 | + ;; |
4524 | + *) |
4525 | + usage >&2 |
4526 | + exit 2 # LSB: invalid or excess argument(s) |
4527 | + ;; |
4528 | +esac |
4529 | |
4530 | === modified file 'scripts/etc/munin/plugin-conf.d/openvista' |
4531 | --- scripts/etc/munin/plugin-conf.d/openvista 2009-08-24 21:28:11 +0000 |
4532 | +++ scripts/etc/munin/plugin-conf.d/openvista 2011-08-22 16:52:24 +0000 |
4533 | @@ -1,2 +1,6 @@ |
4534 | [openvista*] |
4535 | group openvista, gtm |
4536 | + |
4537 | +[openvista_repl_backlog_*] |
4538 | +env.warning 100 |
4539 | +env.critical 1000 |
4540 | |
4541 | === added directory 'scripts/etc/openvista' |
4542 | === added file 'scripts/etc/openvista/lsyncd-routines.exclude' |
4543 | --- scripts/etc/openvista/lsyncd-routines.exclude 1970-01-01 00:00:00 +0000 |
4544 | +++ scripts/etc/openvista/lsyncd-routines.exclude 2011-08-22 16:52:24 +0000 |
4545 | @@ -0,0 +1,2 @@ |
4546 | +*.swx |
4547 | +*.swp |
4548 | |
4549 | === added file 'scripts/etc/openvista/mysqlusers' |
4550 | --- scripts/etc/openvista/mysqlusers 1970-01-01 00:00:00 +0000 |
4551 | +++ scripts/etc/openvista/mysqlusers 2011-08-22 16:52:24 +0000 |
4552 | @@ -0,0 +1,13 @@ |
4553 | +# MySQL users |
4554 | +# If these values are changed, they must be changed on both primary and |
4555 | +# secondary servers. If MySQL replication has already been set up, then |
4556 | +# ovmysqlrepl must be re-run on each server to reconfigure MySQL replication |
4557 | +# so that the user accounts are updated. |
4558 | + |
4559 | +# MySQL user for replication threads of the mysql process |
4560 | +MASTER_USER="mysqlrepl" |
4561 | +MASTER_PASSWORD="0909" |
4562 | +# MySQL user for testing replication |
4563 | +TEST_USER="mysqltest" |
4564 | +TEST_PASSWORD="ntawkrwar" |
4565 | + |
4566 | |
4567 | === added file 'scripts/etc/openvista/network-interface' |
4568 | --- scripts/etc/openvista/network-interface 1970-01-01 00:00:00 +0000 |
4569 | +++ scripts/etc/openvista/network-interface 2011-08-22 16:52:24 +0000 |
4570 | @@ -0,0 +1,15 @@ |
4571 | +# This file is sourced by /etc/openvista/primary.d/openvista-ip. |
4572 | +# |
4573 | +# DEVICE should be set to the network interface for the IP address used by |
4574 | +# applications, e.g., DEVICE=eth0:0 |
4575 | +# |
4576 | +# This interface should be configured, but not started, with the same IP address |
4577 | +# on both the primary server and the secondary server. Since openvista-ip runs |
4578 | +# only for the primary server, the primary server will serve OpenVista on that |
4579 | +# address, and when a switchover occurs, this script will bring the interface |
4580 | +# down for the old primary and up for the new primary so that clients will |
4581 | +# automatically find the new server at the same IP address. |
4582 | +# |
4583 | +# GT.M Replication Network Configuration |
4584 | +# https://intranet.medsphere.com/docs/DOC-4164 |
4585 | +DEVICE= |
4586 | |
4587 | === added directory 'scripts/etc/openvista/primary.d' |
4588 | === added file 'scripts/etc/openvista/primary.d/openvista-ip' |
4589 | --- scripts/etc/openvista/primary.d/openvista-ip 1970-01-01 00:00:00 +0000 |
4590 | +++ scripts/etc/openvista/primary.d/openvista-ip 2011-08-22 16:52:24 +0000 |
4591 | @@ -0,0 +1,114 @@ |
4592 | +#!/bin/bash |
4593 | + |
4594 | +# openvista-ip |
4595 | +# Script to bring up the network interface of the service IP address of the |
4596 | +# primary OpenVista server. |
4597 | + |
4598 | +# Copyright (C) 2010 Medsphere Systems Corporation |
4599 | +# |
4600 | +# This program is free software; you can redistribute it and/or modify it |
4601 | +# solely under the terms of the GNU Affero General Public License version 3 |
4602 | +# as published by the Free Software Foundation. |
4603 | +# |
4604 | +# This program is distributed in the hope that it will be useful, but WITHOUT |
4605 | +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
4606 | +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License |
4607 | +# for more details. |
4608 | +# |
4609 | +# You should have received a copy of the GNU Affero General Public License |
4610 | +# along with this program. If not, see <http://www.gnu.org/licenses>. |
4611 | +# |
4612 | +# You can contact Medsphere Systems Corporation headquarters at 1917 Palomar |
4613 | +# Oaks Way, Suite 200, Carlsbad, CA 92008 or at legal@medsphere.com. |
4614 | + |
4615 | + |
4616 | +# source function libraries |
4617 | +# CentOS/RHEL, provides action(), status() |
4618 | +[[ -f /etc/rc.d/init.d/functions ]] && . /etc/rc.d/init.d/functions |
4619 | +# Ubuntu/Debian, provides log_daemon_msg(), status_of_proc() |
4620 | +[[ -f /lib/lsb/init-functions ]] && . /lib/lsb/init-functions |
4621 | +# OpenVista |
4622 | +. /usr/lib/openvista/functions |
4623 | + |
4624 | +log_command_usage "$@" |
4625 | + |
4626 | +# read the name of the network adapter, e.g. eth1:0 |
4627 | +# See the comments within the file for details. |
4628 | +config_file=/etc/openvista/network-interface |
4629 | +. "$config_file" |
4630 | + |
4631 | +usage() |
4632 | +{ |
4633 | + # Display usage information. |
4634 | + cat <<EOF |
4635 | +Usage: ip {start|stop|restart|force-reload|status} |
4636 | +EOF |
4637 | +} |
4638 | + |
4639 | +init_logged_call() |
4640 | +{ |
4641 | + message=$1 |
4642 | + shift |
4643 | + cmd_args=( "$@" ) |
4644 | + if function_exists "action"; then |
4645 | + # CentOS/RHEL |
4646 | + action "$message" "${cmd_args[@]}" |
4647 | + elif function_exists "log_daemon_msg"; then |
4648 | + # Ubuntu/Debian |
4649 | + log_daemon_msg "$message" |
4650 | + "${cmd_args[@]}" |
4651 | + retval=$? |
4652 | + log_end_msg "$retval" |
4653 | + return "$retval" |
4654 | + else |
4655 | + # other |
4656 | + "${cmd_args[@]}" |
4657 | + fi |
4658 | +} |
4659 | + |
4660 | +# check that user is root |
4661 | +[[ $(id -u) == 0 ]] || exit_command 4 "Must be run as root" |
4662 | + |
4663 | +# exit with an instructive error message if DEVICE is not set |
4664 | +if ! [[ "$DEVICE" ]]; then |
4665 | + exit_command 1 \ |
4666 | + "DEVICE is not set for the OpenVista service address. See '$config_file'" |
4667 | +fi |
4668 | + |
4669 | +case $1 in |
4670 | + start) |
4671 | + message="Bringing up network adapter '$DEVICE' for OpenVista" |
4672 | + if init_logged_call "$message" /sbin/ifup "$DEVICE"; then |
4673 | + log -l "Network adapter '$DEVICE' brought up for OpenVista" |
4674 | + /sbin/ifconfig "$DEVICE" \ |
4675 | + | grep inet \ |
4676 | + | sed -nr 's/^\s*(.*)/\1/p' \ |
4677 | + | log -lp |
4678 | + [[ -d /var/lock/subsys ]] && touch /var/lock/subsys/openvista-ip |
4679 | + fi |
4680 | + ;; |
4681 | + stop) |
4682 | + message="Bringing down network adapter '$DEVICE' for OpenVista" |
4683 | + if init_logged_call "$message" /sbin/ifdown "$DEVICE"; then |
4684 | + log -l "Network adapter '$DEVICE' brought down for OpenVista" |
4685 | + [[ -d /var/lock/subsys ]] && rm -f /var/lock/subsys/openvista-ip |
4686 | + fi |
4687 | + ;; |
4688 | + restart|force-reload) |
4689 | + $0 stop |
4690 | + $0 start |
4691 | + ;; |
4692 | + status) |
4693 | + /sbin/ifconfig "$DEVICE" \ |
4694 | + | grep inet |
4695 | + ;; |
4696 | + address) |
4697 | + /sbin/ifconfig "$DEVICE" \ |
4698 | + | grep inet \ |
4699 | + | sed -nr "s/^.*inet addr:(([0-9]{1,3}\.){3}[0-9]{1,3}).*$/\1/p" |
4700 | + ;; |
4701 | + *) |
4702 | + usage >&2 |
4703 | + exit 2 # LSB: invalid or excess argument(s) |
4704 | + ;; |
4705 | +esac |
4706 | |
4707 | === added directory 'scripts/etc/openvista/secondary.d' |
4708 | === modified file 'scripts/usr/bin/openvista' |
4709 | --- scripts/usr/bin/openvista 2010-12-07 00:31:07 +0000 |
4710 | +++ scripts/usr/bin/openvista 2011-08-22 16:52:24 +0000 |
4711 | @@ -11,22 +11,24 @@ |
4712 | # This program is free software; you can redistribute it and/or modify it solely |
4713 | # under the terms of the GNU Affero General Public License version 3 as published |
4714 | # by the Free Software Foundation. |
4715 | -# |
4716 | +# |
4717 | # This program is distributed in the hope that it will be useful, but WITHOUT |
4718 | # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
4719 | # FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License |
4720 | # for more details. |
4721 | -# |
4722 | +# |
4723 | # You should have received a copy of the GNU Affero General Public License |
4724 | # along with this program. If not, see <http://www.gnu.org/licenses>. |
4725 | -# |
4726 | -# You can contact Medsphere Systems Corporation headquarters at 1917 Palomar |
4727 | +# |
4728 | +# You can contact Medsphere Systems Corporation headquarters at 1917 Palomar |
4729 | # Oaks Way, Suite 200, Carlsbad, CA 92008 or at legal@medsphere.com. |
4730 | |
4731 | |
4732 | # common functions |
4733 | . /usr/lib/openvista/functions |
4734 | |
4735 | +log_command_usage "$@" |
4736 | + |
4737 | # parse arguments |
4738 | while getopts hV option; do |
4739 | case $option in |
4740 | @@ -35,6 +37,7 @@ |
4741 | Usage: openvista INSTANCE_NAME |
4742 | or openvista -h |
4743 | or openvista -V |
4744 | +Access a MUMPS programmer prompt for the specified OpenVista instance. |
4745 | |
4746 | -h display this help text and exit |
4747 | -V display version information and exit |
4748 | @@ -43,11 +46,11 @@ |
4749 | ;; |
4750 | V) |
4751 | cat <<EOF |
4752 | -openvista 0.8.11 |
4753 | +openvista 0.9 |
4754 | Copyright (C) 2009 Medsphere Systems Corporation |
4755 | |
4756 | -openvista is powered by Medsphere and part of a suite of open source |
4757 | -utilities licensed under the AGPL, available at http://medsphere.org. |
4758 | +openvista is powered by Medsphere and part of a suite of open source |
4759 | +utilities licensed under the AGPL, available at http://medsphere.org. |
4760 | EOF |
4761 | exit 0 |
4762 | ;; |
4763 | @@ -62,17 +65,8 @@ |
4764 | exit 2 |
4765 | fi |
4766 | |
4767 | -# check permissions |
4768 | -in_groups || { |
4769 | - echo "openvista: permission denied" >&2 |
4770 | - exit 1 |
4771 | -} |
4772 | - |
4773 | -# check for for valid arguments (requires correct permissions to do; must happen after permission checks) |
4774 | -set_gtm_env "$1" || { |
4775 | - echo "openvista: $instance: Not an OpenVista instance" >&2 |
4776 | - exit 3 |
4777 | -} |
4778 | +# check for for valid arguments |
4779 | +set_gtm_env -e "$1" |
4780 | |
4781 | # log access to direct mode |
4782 | if [ -z "$SSH_CLIENT" ]; then |
4783 | @@ -85,10 +79,10 @@ |
4784 | umask 007 |
4785 | |
4786 | # switch to temp directory so *.mj[eo] files are created there |
4787 | -# because of the umask, even if two users job off the same routine, |
4788 | -# the second user will be able to overwrite the *.mj[eo] files and |
4789 | -# the JOB command will succeed, but the *.mj[eo] files will become |
4790 | -# garbled (both JOBs will write to them in no particular order) |
4791 | +# because of the umask, even if two users job off the same routine, |
4792 | +# the second user will be able to overwrite the *.mj[eo] files and |
4793 | +# the JOB command will succeed, but the *.mj[eo] files will become |
4794 | +# garbled (both JOBs will write to them in no particular order) |
4795 | cd "$root/$instance/tmp" |
4796 | |
4797 | # enter direct mode |
4798 | @@ -96,4 +90,3 @@ |
4799 | |
4800 | # fix the terminal |
4801 | stty sane 2> /dev/null |
4802 | - |
4803 | |
4804 | === modified file 'scripts/usr/bin/ovbackup' |
4805 | --- scripts/usr/bin/ovbackup 2010-12-07 00:31:07 +0000 |
4806 | +++ scripts/usr/bin/ovbackup 2011-08-22 16:52:24 +0000 |
4807 | @@ -10,32 +10,36 @@ |
4808 | # This program is free software; you can redistribute it and/or modify it solely |
4809 | # under the terms of the GNU Affero General Public License version 3 as published |
4810 | # by the Free Software Foundation. |
4811 | -# |
4812 | +# |
4813 | # This program is distributed in the hope that it will be useful, but WITHOUT |
4814 | # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
4815 | # FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License |
4816 | # for more details. |
4817 | -# |
4818 | +# |
4819 | # You should have received a copy of the GNU Affero General Public License |
4820 | # along with this program. If not, see <http://www.gnu.org/licenses>. |
4821 | -# |
4822 | -# You can contact Medsphere Systems Corporation headquarters at 1917 Palomar |
4823 | +# |
4824 | +# You can contact Medsphere Systems Corporation headquarters at 1917 Palomar |
4825 | # Oaks Way, Suite 200, Carlsbad, CA 92008 or at legal@medsphere.com. |
4826 | |
4827 | |
4828 | # common functions |
4829 | . /usr/lib/openvista/functions |
4830 | |
4831 | +log_command_usage "$@" |
4832 | + |
4833 | # parse arguments |
4834 | -while getopts hVq option; do |
4835 | +while getopts hVqo option; do |
4836 | case $option in |
4837 | h) |
4838 | cat <<EOF |
4839 | Usage: ovbackup [-q] INSTANCE_NAME |
4840 | or ovbackup -h |
4841 | or ovbackup -V |
4842 | +Back up routines and globals of the specified OpenVista instance. |
4843 | |
4844 | -q quiet; suppress status messages |
4845 | + -o output the backup filename |
4846 | -h display this help text and exit |
4847 | -V display version information and exit |
4848 | EOF |
4849 | @@ -43,22 +47,26 @@ |
4850 | ;; |
4851 | V) |
4852 | cat <<EOF |
4853 | -ovbackup 0.8.11 |
4854 | -Copyright (C) 2009 Medsphere Systems Corporation |
4855 | +ovbackup 0.9 |
4856 | +Copyright (C) 2009-2010 Medsphere Systems Corporation |
4857 | |
4858 | -ovbackup is powered by Medsphere and part of a suite of open source |
4859 | -utilities licensed under the AGPL, available at http://medsphere.org. |
4860 | +ovbackup is powered by Medsphere and part of a suite of open source |
4861 | +utilities licensed under the AGPL, available at http://medsphere.org. |
4862 | EOF |
4863 | exit 0 |
4864 | ;; |
4865 | q) |
4866 | skip_status=true |
4867 | ;; |
4868 | + o) |
4869 | + output_filename=true |
4870 | + ;; |
4871 | esac |
4872 | done |
4873 | shift `expr $OPTIND - 1` |
4874 | |
4875 | : ${skip_status:=false} |
4876 | +: ${output_filename:=false} |
4877 | |
4878 | # check command syntax |
4879 | if [ -z "$1" ]; then |
4880 | @@ -67,17 +75,8 @@ |
4881 | exit 2 |
4882 | fi |
4883 | |
4884 | -# check permissions |
4885 | -in_groups || { |
4886 | - echo "ovbackup: permission denied" >&2 |
4887 | - exit 1 |
4888 | -} |
4889 | - |
4890 | -# check for for valid arguments (requires correct permissions to do; must happen after permission checks) |
4891 | -set_gtm_env "$1" || { |
4892 | - echo "ovbackup: $instance: Not an OpenVista instance" >&2 |
4893 | - exit 3 |
4894 | -} |
4895 | +# check for for valid arguments |
4896 | +set_gtm_env -e "$1" |
4897 | |
4898 | if [ -e "$root/$instance/etc/backups.conf" ]; then |
4899 | . "$root/$instance/etc/backups.conf" |
4900 | @@ -94,7 +93,7 @@ |
4901 | print_status "ovbackup" "Options:" "true" |
4902 | print_status "ovbackup" " -q (quiet) = $skip_status" "true" |
4903 | |
4904 | -tempdir=`mktemp -d -p "$root/$instance/backups" .ovbackup.XXXXXXXXXX` || |
4905 | +tempdir=`mktemp -d -p "$root/$instance/backups" .ovbackup.XXXXXXXXXX` || |
4906 | exit_with_error "ovbackup" "Unable to create temporary directory" |
4907 | |
4908 | # the EXIT handler may or may not run if we're interrupted or killed depending |
4909 | @@ -113,12 +112,12 @@ |
4910 | |
4911 | print_status "ovbackup" "Copying configuration files" "$skip_status" |
4912 | |
4913 | -install -m 2750 -d "$tempdir/etc" || |
4914 | +install -m 2750 -d "$tempdir/etc" || |
4915 | exit_with_error "ovbackup" "Unable to copy configuration files" |
4916 | |
4917 | # copy env file if it exists |
4918 | if [ -f "$root/$instance/etc/env" ]; then |
4919 | - cp -p "$root/$instance/etc/env" "$tempdir/etc/" || |
4920 | + cp -p "$root/$instance/etc/env" "$tempdir/etc/" || |
4921 | exit_with_error "ovbackup" "Unable to copy env configuration file" |
4922 | fi |
4923 | |
4924 | @@ -128,7 +127,7 @@ |
4925 | # not the symlink itself). this allows administrators to reference routines |
4926 | # outside the OpenVista instance's routines directory and still have them |
4927 | # backed up (e.g., to share routines between OpenVista instances) |
4928 | -cp -RLp "$root/$instance/routines" "$tempdir" || |
4929 | +cp -RLp "$root/$instance/routines" "$tempdir" || |
4930 | exit_with_error "ovbackup" "Unable to copy routines" |
4931 | |
4932 | print_status "ovbackup" "Copying database files" "$skip_status" |
4933 | @@ -200,9 +199,11 @@ |
4934 | |
4935 | print_status "ovbackup" "Compressing backup" "$skip_status" |
4936 | |
4937 | +backup_name="${instance}-$timestamp.tar.bz2" |
4938 | + |
4939 | ( |
4940 | umask 007 |
4941 | - tar -c --remove-files `choose_bzip2` -f "$tempdir/${instance}-$timestamp.tar.bz2" -C "$tempdir" gtm_version etc routines globals |
4942 | + tar -c --remove-files `choose_bzip2` -f "$tempdir/${backup_name}" -C "$tempdir" gtm_version etc routines globals |
4943 | ) || exit_with_error "ovbackup" "Unable to compress temporary backup directory" |
4944 | |
4945 | # since redirection is not safe (it follows symlinks), create the file in the |
4946 | @@ -210,14 +211,18 @@ |
4947 | # md5sum fails, ignore the error. |
4948 | ( |
4949 | umask 007 && |
4950 | - md5sum < "$tempdir/${instance}-$timestamp.tar.bz2" | sed 's/-$/'"${instance}-$timestamp.tar.bz2"'/' > "$tempdir/${instance}-$timestamp.tar.bz2.md5" |
4951 | - mv "$tempdir/${instance}-$timestamp.tar.bz2.md5" "$root/$instance/backups/${instance}-$timestamp.tar.bz2.md5" |
4952 | + md5sum < "$tempdir/${backup_name}" | sed 's/-$/'"${backup_name}"'/' > "$tempdir/${backup_name}.md5" |
4953 | + mv "$tempdir/${backup_name}.md5" "$root/$instance/backups/${backup_name}.md5" |
4954 | ) |
4955 | |
4956 | -mv "$tempdir/${instance}-$timestamp.tar.bz2" "$root/$instance/backups/${instance}-$timestamp.tar.bz2" || |
4957 | +backup_filename="$root/$instance/backups/${backup_name}" |
4958 | + |
4959 | +mv "$tempdir/${backup_name}" "$backup_filename" || |
4960 | exit_with_error "ovbackup" "Unable to rename backup file" |
4961 | |
4962 | -print_status "ovbackup" "Backup of $instance written to $root/$instance/backups/${instance}-$timestamp.tar.bz2" "$skip_status" |
4963 | +print_status "ovbackup" "Backup of $instance written to $backup_filename" "$skip_status" |
4964 | + |
4965 | +$output_filename && log -s "$backup_filename" |
4966 | |
4967 | # remove the oldest backup file until there are only $num_backups remaining |
4968 | until [ `find "$root/$instance/backups/" -type f -name "*.tar.bz2" | wc -l` -le $num_backups ]; do |
4969 | |
4970 | === modified file 'scripts/usr/bin/ovcc' |
4971 | --- scripts/usr/bin/ovcc 2010-12-07 00:31:07 +0000 |
4972 | +++ scripts/usr/bin/ovcc 2011-08-22 16:52:24 +0000 |
4973 | @@ -11,22 +11,24 @@ |
4974 | # This program is free software; you can redistribute it and/or modify it solely |
4975 | # under the terms of the GNU Affero General Public License version 3 as published |
4976 | # by the Free Software Foundation. |
4977 | -# |
4978 | +# |
4979 | # This program is distributed in the hope that it will be useful, but WITHOUT |
4980 | # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
4981 | # FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License |
4982 | # for more details. |
4983 | -# |
4984 | +# |
4985 | # You should have received a copy of the GNU Affero General Public License |
4986 | # along with this program. If not, see <http://www.gnu.org/licenses>. |
4987 | -# |
4988 | -# You can contact Medsphere Systems Corporation headquarters at 1917 Palomar |
4989 | +# |
4990 | +# You can contact Medsphere Systems Corporation headquarters at 1917 Palomar |
4991 | # Oaks Way, Suite 200, Carlsbad, CA 92008 or at legal@medsphere.com. |
4992 | |
4993 | |
4994 | # common functions |
4995 | . /usr/lib/openvista/functions |
4996 | |
4997 | +log_command_usage "$@" |
4998 | + |
4999 | # parse arguments |
5000 | while getopts hV option; do |
The diff has been truncated for viewing.