-
Notifications
You must be signed in to change notification settings - Fork 36
/
Copy pathconfig
658 lines (507 loc) · 16.8 KB
/
config
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
#
# Test install directory
#
_INSTALL_PREFIX="/opt/mysqldump-secure/tests"
#
# MySQL Ports
#
SQL_MASTER_PORT="13306"
SQL_SLAVE_PORT="13307"
#
# 3 possible commands
#
CMD_CRON="sudo ${_INSTALL_PREFIX}/bin/mysqldump-secure --cron"
CMD_NORM="sudo ${_INSTALL_PREFIX}/bin/mysqldump-secure"
CMD_VERB="sudo ${_INSTALL_PREFIX}/bin/mysqldump-secure -vv"
CMD_HELP="sudo ${_INSTALL_PREFIX}/bin/mysqldump-secure --help"
CMD_TEST="sudo ${_INSTALL_PREFIX}/bin/mysqldump-secure --test"
#
# Some colors for the test output
#
txtgrn=$(tput setaf 2) # Green
txtylw=$(tput setaf 3) # Yellow
txtblu=$(tput setaf 4) # Blue
txtpur=$(tput setaf 5) # Purple
txtcyn=$(tput setaf 6) # Cyan
txtwht=$(tput setaf 7) # White
txtrst=$(tput sgr0) # Text reset.
#
# Is it Debian-based? (tmpwatch or tmpreaper)
#
if command -v apt-get >/dev/null 2>&1; then
TMPWATCH="tmpreaper"
else
TMPWATCH="tmpwatch"
fi
#
# What checks do we want to run
# Tests 02-11:
#
RUN_CHECK_CRON=1 # Check for cron mode?
RUN_CHECK_NORM=0 # Check for normal mode?
RUN_CHECK_VERB=1 # Check for verbose mode?
################################################################################
#
# Some repeating functions
#
################################################################################
#
# sed 's//g' wrapper
#
sed_change_config_file() {
_find="${1}"
_repl="${2}"
sudo sed -i'' "s|${_find}|${_repl}|" ${_INSTALL_PREFIX}/etc/mysqldump-secure.conf
}
#
# This runs all the checks as fast as possible
# One run for all checks.
#
check() {
_data_dir="${1}" # Recreate datadir?
# 1.) Run test
_run="${2}" # Do run test? (1|0)
_ret="${3}" # Expected return (PASS|FAIL)
# 2.) Expect test
_exp="${4}" # Check for expected string? (1|0)
_str="${5}" # String that must be found
# 3.) Unbound variable test
_var="${6}" # Do unbound variable test? (1|0)
# 4.) Syntax error test
_syn="${7}" # Do syntax error test? (1|0)
# 5.) Do end test (check if program run till the end)
_end="${8}" # Do end test? (1|0)
# 6.) Import back into mysql
#
# Values:
# 0: Do not import
# 1: plain import
# 2: compressed import
# 3: encrypted import
# 4: compressed & encrypted import
_import="${9}" # (0|1|2|3|4)
# Command to execute
_cmd="${@:10}"
# Count errors
_ERROR=0
#
# RECREATE DATADIR?
#
if [ "${_data_dir}" = "1" ]; then
if [ -d ${_INSTALL_PREFIX}/var/mysqldump-secure/ ]; then
sudo rm -rf ${_INSTALL_PREFIX}/var/mysqldump-secure/
fi
sudo mkdir -p ${_INSTALL_PREFIX}/var/mysqldump-secure/
sudo chmod 0700 ${_INSTALL_PREFIX}/var/mysqldump-secure/
fi
#
# RESET LOGGING FILE PERMISSIONS
#
if [ ! -f "${_INSTALL_PREFIX}/var/log/mysqldump-secure.log" ]; then
sudo touch "${_INSTALL_PREFIX}/var/log/mysqldump-secure.log"
fi
sudo chmod 0600 "${_INSTALL_PREFIX}/var/log/mysqldump-secure.log"
if [ ! -f "${_INSTALL_PREFIX}/var/log/mysqldump-secure.nagios.log" ]; then
sudo touch "${_INSTALL_PREFIX}/var/log/mysqldump-secure.nagios.log"
fi
sudo chmod 0644 "${_INSTALL_PREFIX}/var/log/mysqldump-secure.nagios.log"
#
# These files can only be deleted via tmpwatch/tmpreaper -f (--force)
#
sudo touch -a -m -t 201512180130.09 ${_INSTALL_PREFIX}/var/mysqldump-secure/delete-me-1.txt && sudo chmod 400 ${_INSTALL_PREFIX}/var/mysqldump-secure/delete-me-1.txt
sudo touch -a -m -t 201512180130.09 ${_INSTALL_PREFIX}/var/mysqldump-secure/delete-me-2.txt && sudo chmod 400 ${_INSTALL_PREFIX}/var/mysqldump-secure/delete-me-2.txt
sudo touch -a -m -t 201512180130.09 ${_INSTALL_PREFIX}/var/mysqldump-secure/delete-me-3.txt && sudo chmod 400 ${_INSTALL_PREFIX}/var/mysqldump-secure/delete-me-3.txt
sudo touch -a -m -t 201512180130.09 ${_INSTALL_PREFIX}/var/mysqldump-secure/delete-me-4.txt && sudo chmod 400 ${_INSTALL_PREFIX}/var/mysqldump-secure/delete-me-4.txt
sudo touch -a -m -t 201512180130.09 ${_INSTALL_PREFIX}/var/mysqldump-secure/delete-me-5.txt && sudo chmod 400 ${_INSTALL_PREFIX}/var/mysqldump-secure/delete-me-5.txt
#
# EXECUTE THE COMMAND
#
echo "\$ ${txtblu}${_cmd}${txtrst}"
_OUTPUT="$(${_cmd} 2>&1)"
_RETURN="$?"
#
# Remove those files
#
sudo rm -f ${_INSTALL_PREFIX}/var/mysqldump-secure/delete-me-1.txt
sudo rm -f ${_INSTALL_PREFIX}/var/mysqldump-secure/delete-me-2.txt
sudo rm -f ${_INSTALL_PREFIX}/var/mysqldump-secure/delete-me-3.txt
sudo rm -f ${_INSTALL_PREFIX}/var/mysqldump-secure/delete-me-4.txt
sudo rm -f ${_INSTALL_PREFIX}/var/mysqldump-secure/delete-me-5.txt
# Get all errors and warnings
_OUTPUT_STDERR="$(echo "${_OUTPUT}" | grep '\[WARN\]\|\[ERR\]\|\[FATAL\]')"
#
# AND SHOW THE COMMAND
#
#echo "${_OUTPUT}"
echo
echo
#
# 1.) RUN TEST
#
if [ "${_run}" = "1" ]; then
echo "\$ ${txtblu}1. RUN TEST ...${txtrst}"
echo "${_OUTPUT_STDERR}"
# Program must succeed
if [ "${_ret}" = "PASS" ]; then
if [ "${_RETURN}" != "0" ]; then
echo
echo
echo "--------------- config output due to error: ---------------"
echo
sudo cat ${_INSTALL_PREFIX}/etc/mysqldump-secure.conf
echo
echo
echo "--------------- run output due to error: ---------------"
echo
echo "${_OUTPUT}"
echo "${txtpur}===> [FAIL]${txtrst}"
echo "${txtpur}===> [FAIL] Failed with: ${_RETURN} (should have passed with 0)${txtrst}"
echo "${txtpur}===> [FAIL]${txtrst}"
_ERROR=$((_ERROR+1));
elif [ "${_OUTPUT_STDERR}" != "" ]; then
echo
echo
echo "--------------- config output due to error: ---------------"
echo
sudo cat ${_INSTALL_PREFIX}/etc/mysqldump-secure.conf
echo
echo
echo "--------------- run output due to error: ---------------"
echo
echo "${_OUTPUT}"
echo "${txtpur}===> [FAIL]${txtrst}"
echo "${txtpur}===> [FAIL] stderr output present, but should not be${txtrst}"
echo "${txtpur}===> [FAIL]${txtrst}"
_ERROR=$((_ERROR+1));
else
echo "${txtgrn}===> [OK] Success${txtrst}"
fi
# Program must exit with warnings
elif [ "${_ret}" = "WARN" ]; then
if [ "${_RETURN}" != "1" ]; then
echo
echo
echo "--------------- config output due to error: ---------------"
echo
sudo cat ${_INSTALL_PREFIX}/etc/mysqldump-secure.conf
echo
echo
echo "--------------- run output due to error: ---------------"
echo
echo "${_OUTPUT}"
echo "${txtpur}===> [FAIL]${txtrst}"
echo "${txtpur}===> [FAIL] Wrong exit code. Expected '1' (WARNING) got: '${_RETURN}'${txtrst}"
echo "${txtpur}===> [FAIL]${txtrst}"
_ERROR=$((_ERROR+1));
else
echo "${txtgrn}===> [OK] Expected exit with WARNING.${txtrst}"
fi
# Program must exit with errors
elif [ "${_ret}" = "ERR" ]; then
if [ "${_RETURN}" != "2" ]; then
echo
echo
echo "--------------- config output due to error: ---------------"
echo
sudo cat ${_INSTALL_PREFIX}/etc/mysqldump-secure.conf
echo
echo
echo "--------------- run output due to error: ---------------"
echo
echo "${_OUTPUT}"
echo "${txtpur}===> [FAIL]${txtrst}"
echo "${txtpur}===> [FAIL] Wrong exit code. Expected '2' (ERROR) got: '${_RETURN}'${txtrst}"
echo "${txtpur}===> [FAIL]${txtrst}"
_ERROR=$((_ERROR+1));
else
echo "${txtgrn}===> [OK] Expected exit with ERROR.${txtrst}"
fi
# Program must fail
elif [ "${_ret}" = "FAIL" ]; then
if [ "${_RETURN}" != "3" ]; then
echo
echo
echo "--------------- config output due to error: ---------------"
echo
sudo cat ${_INSTALL_PREFIX}/etc/mysqldump-secure.conf
echo
echo
echo "--------------- run output due to error: ---------------"
echo
echo "${_OUTPUT}"
echo "${txtpur}===> [FAIL]${txtrst}"
echo "${txtpur}===> [FAIL] Wrong exit code. Expected '3' (FAIL) got: '${_RETURN}'${txtrst}"
echo "${txtpur}===> [FAIL]${txtrst}"
_ERROR=$((_ERROR+1));
else
echo "${txtgrn}===> [OK] Expected exit with FAIL.${txtrst}"
fi
# Program must exit with errors
elif [ "${_ret}" = "ABORT" ]; then
if [ "${_RETURN}" != "4" ]; then
echo
echo
echo "--------------- config output due to error: ---------------"
echo
sudo cat ${_INSTALL_PREFIX}/etc/mysqldump-secure.conf
echo
echo
echo "--------------- run output due to error: ---------------"
echo
echo "${_OUTPUT}"
echo "${txtpur}===> [FAIL]${txtrst}"
echo "${txtpur}===> [FAIL] Wrong exit code. Expected '4' (ABORT) got: '${_RETURN}'${txtrst}"
echo "${txtpur}===> [FAIL]${txtrst}"
_ERROR=$((_ERROR+1));
else
echo "${txtgrn}===> [OK] Expected exit with ABORT.${txtrst}"
fi
# Something else happened
else
echo "${txtpur}===> [FAIL]${txtrst}"
echo "${txtgrn}===> [FAIL] Invalid usage for 'check()'${txtrst}"
echo "${txtpur}===> [FAIL]${txtrst}"
_ERROR=$((_ERROR+1));
fi
echo
fi
#
# 2.) EXPECT TEST (expect string)
#
if [ "${_exp}" = "1" ]; then
echo "\$ ${txtblu}2. EXPECTED ERROR TEST ...${txtrst}"
_found="$(echo "${_OUTPUT}" | grep '\[WARN\]\|\[ERR\]\|\[FATAL\]' | grep -A 1 -B 1 --color=always -e "${_str}")"
if [ "${_found}" = "" ]; then
echo "${txtpur}===> [FAIL]${txtrst}"
echo "${txtpur}===> [FAIL] Expected error string not found in stderr:${txtrst} ${txtblu}\"${_str}\"${txtrst}"
echo "${txtpur}===> [FAIL]${txtrst}"
_ERROR=$((_ERROR+1));
else
echo "${_found}"
echo "${txtgrn}===> [OK] Expected error string found in stderr:${txtrst} ${txtblu}\"${_str}\"${txtrst}"
fi
echo
fi
#
# 3.) UNBOUND VARIABLE TEST
#
if [ "${_var}" = "1" ]; then
echo "\$ ${txtblu}3. UNBOUND VARIABLE TEST ...${txtrst}"
_found="$(echo "${_OUTPUT}" | grep 'parameter not set')"
if [ "${_found}" != "" ]; then
echo "${unbound}"
echo "${txtpur}===> [FAIL]${txtrst}"
echo "${txtpur}===> [FAIL] Unbound variable found.${txtrst}"
echo "${txtpur}===> [FAIL]${txtrst}"
_ERROR=$((_ERROR+1));
else
echo "${txtgrn}===> [OK] No unbound variables found.${txtrst}"
fi
echo
fi
#
# 4.) SYNTAX ERROR TEST
#
if [ "${_syn}" = "1" ]; then
echo "\$ ${txtblu}4. SYNTAX ERROR TEST ...${txtrst}"
_err="0"
_unfound="$(echo "${_OUTPUT}" | grep -E '.*[0-9]*:.*: not found.*')"
_syntax="$(echo "${_OUTPUT}" | grep -E '.*[0-9]*:.*: Syntax error:.*')"
_file="$(echo "${_OUTPUT}" | grep -E '^.*: line [0-9]*:[[:space:]].*:.*')"
if [ "${_syntax}" != "" ]; then
echo "${_syntax}"
_err="1"
_ERROR=$((_ERROR+1));
fi
if [ "${_unfound}" != "" ]; then
echo "${_unfound}"
_err="1"
_ERROR=$((_ERROR+1));
fi
if [ "${_file}" != "" ]; then
echo "${_file}"
_err="1"
_ERROR=$((_ERROR+1));
fi
if [ "${_err}" != "0" ]; then
echo "${txtpur}===> [FAIL]${txtrst}"
echo "${txtpur}===> [FAIL] Syntax error found.${txtrst}"
echo "${txtpur}===> [FAIL]${txtrst}"
else
echo "${txtgrn}===> [OK] No Syntax error found.${txtrst}"
fi
fi
#
# 5.) END TEST
#
if [ "${_end}" = "1" ]; then
echo "\$ ${txtblu}5. FINISH TEST ...${txtrst}"
_found="$(echo "${_OUTPUT}" | grep -E 'Aborting|Finished successfully|Finished with|invalid argument:')"
if [ "${_found}" = "" ]; then
echo "${_OUTPUT}" | tail -n5
echo "${txtpur}===> [FAIL]${txtrst}"
echo "${txtpur}===> [FAIL] Program aborted before it was finished.${txtrst}"
echo "${txtpur}===> [FAIL]${txtrst}"
_ERROR=$((_ERROR+1));
else
echo "${_OUTPUT}" | tail -n1
echo "${txtgrn}===> [OK] Program run till the very end.${txtrst}"
fi
echo
fi
#
# 6.) IMPORT TEST
#
if [ "${_import}" = "1" ] || [ "${_import}" = "2" ] || [ "${_import}" = "3" ] || [ "${_import}" = "4" ]; then
echo "\$ ${txtblu}6. IMPORT TEST (imoprt back into mysql server)...${txtrst}"
# Recreate database 'mds' for later testing
sudo mysql --defaults-file=${_INSTALL_PREFIX}/etc/mysqldump-secure.cnf -e 'DROP DATABASE mds;'
sudo mysql --defaults-file=${_INSTALL_PREFIX}/etc/mysqldump-secure.cnf -e 'CREATE DATABASE mds;'
for f in $(sudo ls -m "${_INSTALL_PREFIX}/var/mysqldump-secure/" | sed "s/,/ /g"); do
# Ignore *.info files
if echo "${f}" | grep -v '.info$' 2>/dev/null; then
file="${_INSTALL_PREFIX}/var/mysqldump-secure/${f}"
db="$(echo "$f" | sed "s/^.*__//" | sed 's/\.sql.*$//')"
# Case 1: Plain *.sql file
if [ "${_import}" = "1" ]; then
echo "(${txtylw}plain${txtrst}) Importing ${f} ==> ${db}"
sudo cat "${file}" | sudo mysql --defaults-file=${_INSTALL_PREFIX}/etc/mysqldump-secure.cnf $db
_exit="$?"
if [ "${_exit}" != "0" ]; then
echo "${txtpur}===> [FAIL]${txtrst}"
echo "${txtpur}===> [FAIL] Database import failed.${txtrst}"
echo "${txtpur}===> [FAIL]${txtrst}"
_ERROR=$((_ERROR+1));
else
echo "${txtgrn}===> [OK] Import success${txtrst}"
fi
# Case 2: Compressed *.sql.gz file
elif [ "${_import}" = "2" ]; then
echo "(${txtylw}compressed${txtrst}) Importing ${f} ==> ${db}"
sudo gzip --stdout --decompress "${file}" | sudo mysql --defaults-file=${_INSTALL_PREFIX}/etc/mysqldump-secure.cnf $db
_exits="${PIPESTATUS[*]}"
_good=1
for _exit in ${_exits}; do
if [ "${_exit}" != "0" ]; then
_good=0
fi
done
if [ "${_good}" != "1" ]; then
echo "${txtpur}===> [FAIL]${txtrst}"
echo "${txtpur}===> [FAIL] Database import failed.${txtrst}"
echo "${txtpur}===> [FAIL]${txtrst}"
_ERROR=$((_ERROR+1));
else
echo "${txtgrn}===> [OK] Import success${txtrst}"
fi
# Case 3: Encrypted *.sql.enc file
elif [ "${_import}" = "3" ]; then
echo "(${txtylw}encrypted${txtrst}) Importing ${f} ==> ${db}"
sudo openssl smime -decrypt -in "${file}" -binary -inform DEM -inkey "${_INSTALL_PREFIX}/etc/mysqldump-secure.priv.pem" \
| sudo mysql --defaults-file=${_INSTALL_PREFIX}/etc/mysqldump-secure.cnf $db
_exits="${PIPESTATUS[*]}"
_good=1
for _exit in ${_exits}; do
if [ "${_exit}" != "0" ]; then
_good=0
fi
done
if [ "${_good}" != "1" ]; then
echo "${txtpur}===> [FAIL]${txtrst}"
echo "${txtpur}===> [FAIL] Database import failed.${txtrst}"
echo "${txtpur}===> [FAIL]${txtrst}"
_ERROR=$((_ERROR+1));
else
echo "${txtgrn}===> [OK] Import success${txtrst}"
fi
# Case 4: Compressed and Encrypted *.sql.gz.enc file
elif [ "${_import}" = "4" ]; then
echo "(${txtylw}compressed${txtrst} & ${txtylw}encrypted${txtrst}) Importing ${f} ==> ${db}"
sudo openssl smime -decrypt -in "${file}" -binary -inform DEM -inkey "${_INSTALL_PREFIX}/etc/mysqldump-secure.priv.pem" \
| gunzip | sudo mysql --defaults-file=${_INSTALL_PREFIX}/etc/mysqldump-secure.cnf $db
_exits="${PIPESTATUS[*]}"
_good=1
for _exit in ${_exits}; do
if [ "${_exit}" != "0" ]; then
_good=0
fi
done
if [ "${_good}" != "1" ]; then
echo "${txtpur}===> [FAIL]${txtrst}"
echo "${txtpur}===> [FAIL] Database import failed.${txtrst}"
echo "${txtpur}===> [FAIL]${txtrst}"
_ERROR=$((_ERROR+1));
else
echo "${txtgrn}===> [OK] Import success${txtrst}"
fi
fi
fi
done
# Check for string in database table field.
echo "Checking for value 'mysqldump-secure' in Database 'mds', Table 'names', Field: 'name'..."
value="$(sudo mysql --defaults-file=${_INSTALL_PREFIX}/etc/mysqldump-secure.cnf --batch -e 'use mds; select name from names;' | tail -n1)"
if [ "${value}" = "mysqldump-secure" ]; then
echo "${txtgrn}===> [OK] Value 'mysqldump-secure' found${txtrst}"
else
echo "${txtpur}===> [FAIL]${txtrst}"
echo "${txtpur}===> [FAIL] Value 'mysqldump-secure' NOT FOUND${txtrst}"
echo "${txtpur}===> [FAIL]${txtrst}"
_ERROR=$((_ERROR+1));
fi
echo
fi
return ${_ERROR}
}
#
# Check nagios log with nagios plugin
#
check_nagios() {
# 1.) Run test
_run="${1}" # Do run test? (1|0)
_arg="${2}" # Command arguments to pass (string)
_ret="${3}" # Expected return (OK|WARN|ERR|UNKNOWN)
# 2.) Expect test
_exp="${4}" # Check for expected string? (1|0)
_str="${5}" # String that must be found
# Count errors
_ERROR=0
_CMD="$("./nagios/check_mysqldump-secure -f${_INSTALL_PREFIX} ${_arg}")"
#
# EXECUTE THE COMMAND
#
echo "\$ ${txtblu}${_CMD}${txtrst}"
_OUTPUT="$(${_CMD} 2>&1)"
_RETURN="$?"
#
# AND SHOW THE COMMAND
#
#echo "${_OUTPUT}"
echo
echo
}
mds_remove_datadir() {
if [ -d ${_INSTALL_PREFIX}/var/mysqldump-secure/ ]; then
sudo rm -rf ${_INSTALL_PREFIX}/var/mysqldump-secure/
return $?
fi
return 0
}
mds_remove_logfiles() {
_exit=0
if [ -f ${_INSTALL_PREFIX}/var/log/mysqldump-secure.log ]; then
sudo rm -f ${_INSTALL_PREFIX}/var/log/mysqldump-secure.log
if [ "$?" != "0" ]; then _exit=1; fi
fi
if [ -f ${_INSTALL_PREFIX}/var/log/mysqldump-secure.nagios.log ]; then
sudo rm -f ${_INSTALL_PREFIX}/var/log/mysqldump-secure.nagios.log
if [ "$?" != "0" ]; then _exit=1; fi
fi
return $_exit
}
mds_recreate_datadir() {
if [ -d ${_INSTALL_PREFIX}/var/mysqldump-secure/ ]; then
sudo rm -rf ${_INSTALL_PREFIX}/var/mysqldump-secure/ && sudo mkdir -p ${_INSTALL_PREFIX}/var/mysqldump-secure/ && sudo chmod 0700 ${_INSTALL_PREFIX}/var/mysqldump-secure/
return $?
fi
return 0
}