-
Notifications
You must be signed in to change notification settings - Fork 75
/
BOA.sh.txt
3692 lines (3492 loc) · 141 KB
/
BOA.sh.txt
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
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#!/bin/bash
###----------------------------------------###
###
### BOA Meta Installer
###
### Copyright (C) 2010-2024 Omega8.cc
### [email protected] www.omega8.cc
###
### This program is free software. You can
### redistribute it and/or modify it under
### the terms of the GNU GPL as published by
### the Free Software Foundation, version 2
### or later.
###
### This program is distributed in the hope
### that it will be useful, but WITHOUT ANY
### WARRANTY; without even the implied
### warranty of MERCHANTABILITY or FITNESS
### FOR A PARTICULAR PURPOSE. See the GNU GPL
### for more details.
###
### You should have received a copy of the
### GNU GPL along with this program.
### If not, see http://www.gnu.org/licenses/
###
### Code: https://github.com/omega8cc/boa
###
###----------------------------------------###
###----------------------------------------###
### How To: run it with bash, not with sh ###
###----------------------------------------###
###
### $ wget -qO- http://files.aegir.cc/BOA.sh.txt | bash
###
###----------------------------------------###
### DON'T EDIT ANYTHING BELOW THIS LINE ###
###----------------------------------------###
export HOME=/root
export SHELL=/bin/bash
export PATH=/usr/local/bin:/usr/local/sbin:/opt/local/bin:/usr/bin:/usr/sbin:/bin:/sbin
export _tRee=dev
export _xSrl=550devT01
###
### Avoid too many questions
###
export DEBIAN_FRONTEND=noninteractive
export APT_LISTCHANGES_FRONTEND=none
if [ -z "${TERM+x}" ]; then
export TERM=vt100
fi
_NOW=$(date +%y%m%d-%H%M%S 2>&1)
export _NOW=${_NOW//[^0-9-]/}
_TODAY=$(date +%y%m%d 2>&1)
export _TODAY=${_TODAY//[^0-9]/}
#
_barCnf="/root/.barracuda.cnf"
_crlGet="-L --max-redirs 3 -k -s --retry 9 --retry-delay 9 -A iCab"
_wgetGet="--max-redirect=3 --no-check-certificate -q --tries=9 --wait=9 --user-agent='iCab'"
_aptAllow="--allow-unauthenticated"
_aptYesUnth="-y ${_aptAllow}"
_optBin="/opt/local/bin"
_usrBin="/usr/local/bin"
_pthLog="/var/xdrago/log"
if [ ! -e "${_pthLog}" ] && [ -e "/var/xdrago_wait/log" ]; then
_pthLog="/var/xdrago_wait/log"
fi
_tBn="tools/bin"
_vBs="/var/backups"
#
_eldirF="0001-Print-site_footer-if-defined.patch"
_eldirP="/var/xdrago/conf/${_eldirF}"
#
_dctpF="drupal-ten-aegir-01.patch"
_dctpP="/data/conf/patches/${_dctpF}"
#
_dctrF="drupal-ten-aegir-02.patch"
_dctrP="/data/conf/patches/${_dctrF}"
#
_provLeInc="provision_hosting_le.drush.inc"
_provLeIncFull="/var/xdrago/conf/${_provLeInc}"
#
_hoLeInc="hosting_le_vhost.drush.inc"
_hoLeIncFull="/var/xdrago/conf/${_hoLeInc}"
#
_dehydName="dehydrated"
_dehydSrcPath="/var/xdrago/conf/${_dehydName}"
_legacyLeSh="/var/xdrago/conf/letsencrypt.sh"
_DEBUG_MODE=$([ -e "/root/.debug-barracuda-installer.cnf" ] && echo "YES" || echo "NO")
_os_detection_minimal() {
_APT_UPDATE="apt-get update"
_OS_CODE=$(lsb_release -ar 2>/dev/null | grep -i codename | cut -s -f2 2>&1)
_OS_LIST="daedalus chimaera beowulf buster bullseye bookworm"
for e in ${_OS_LIST}; do
if [ "${e}" = "${_OS_CODE}" ]; then
_APT_UPDATE="apt-get update --allow-releaseinfo-change"
fi
done
}
_apt_clean_update() {
${_APT_UPDATE} -qq &> /dev/null
}
_CHECK_HOST=$(uname -n 2>&1)
_if_hosted_sys() {
if [ -e "/root/.host8.cnf" ] \
|| [[ "${_CHECK_HOST}" =~ ".aegir.cc"($) ]]; then
_hostedSys=YES
else
_hostedSys=NO
fi
}
#
# Find correct IP.
_find_correct_ip() {
if [ -e "/root/.found_correct_ipv4.cnf" ]; then
_LOC_IP=$(cat /root/.found_correct_ipv4.cnf 2>&1)
_LOC_IP=$(echo -n ${_LOC_IP} | tr -d "\n" 2>&1)
else
_LOC_IP=$(curl ${_crlGet} https://api.ipify.org \
| sed 's/[^0-9\.]//g' 2>&1)
if [ -z "${_LOC_IP}" ]; then
_LOC_IP=$(curl ${_crlGet} http://ipv4.icanhazip.com \
| sed 's/[^0-9\.]//g' 2>&1)
fi
if [ ! -z "${_LOC_IP}" ]; then
echo ${_LOC_IP} > /root/.found_correct_ipv4.cnf
fi
fi
}
_fix_dns_settings() {
mkdir -p ${_vBs}
rm -f ${_vBs}/resolv.conf.tmp
if [ -e "/etc/resolv.conf" ]; then
if [ -L "/etc/resolv.conf" ]; then
_rslvT=`readlink -n /etc/resolv.conf`
if [ ! -e "${_rslvT}" ]; then
rm -f /etc/resolv.conf
fi
fi
if [ -e "/etc/resolv.conf" ]; then
cp -a /etc/resolv.conf ${_vBs}/resolv.conf.tmp
fi
fi
if [ ! -e "${_vBs}/resolv.conf.tmp" ]; then
echo "nameserver 127.0.0.1" > ${_vBs}/resolv.conf.tmp
echo "nameserver 1.1.1.1" >> ${_vBs}/resolv.conf.tmp
echo "nameserver 1.0.0.1" >> ${_vBs}/resolv.conf.tmp
echo "nameserver 8.8.8.8" >> ${_vBs}/resolv.conf.tmp
echo "nameserver 8.8.4.4" >> ${_vBs}/resolv.conf.tmp
fi
if [ ! -e "${_vBs}/resolv.conf.vanilla" ] \
&& [ -e "${_vBs}/resolv.conf.tmp" ]; then
if [ "${_USE_DEFAULT_DNS}" != "YES" ]; then
rm -f /etc/resolv.conf
cp -a ${_vBs}/resolv.conf.tmp /etc/resolv.conf
cp -a ${_vBs}/resolv.conf.tmp ${_vBs}/resolv.conf.vanilla
fi
fi
sed -i "/^$/d" ${_vBs}/resolv.conf.vanilla &> /dev/null
if [ -e "${_vBs}/resolv.conf.vanilla" ]; then
if [ "${_USE_DEFAULT_DNS}" != "YES" ]; then
rm -f /etc/resolv.conf
cp -a ${_vBs}/resolv.conf.vanilla /etc/resolv.conf
fi
else
if [ -e "${_vBs}/resolv.conf.tmp" ] \
&& [ "${_USE_DEFAULT_DNS}" != "YES" ]; then
rm -f /etc/resolv.conf
cp -a ${_vBs}/resolv.conf.tmp /etc/resolv.conf
fi
fi
}
_check_dns_settings() {
if [ -e "/root/.use.default.nameservers.cnf" ]; then
_USE_DEFAULT_DNS=YES
fi
if [ -e "/root/.use.local.nameservers.cnf" ]; then
_USE_PROVIDER_DNS=YES
else
_REMOTE_DNS_TEST=$(host files.aegir.cc 1.1.1.1 -w 10 2>&1)
fi
if [[ "${_REMOTE_DNS_TEST}" =~ "no servers could be reached" ]] \
|| [[ "${_REMOTE_DNS_TEST}" =~ "Host files.aegir.cc not found" ]] \
|| [ "${_USE_DEFAULT_DNS}" = "YES" ] \
|| [ "${_USE_PROVIDER_DNS}" = "YES" ]; then
if [ "${_USE_DEFAULT_DNS}" = "YES" ] \
|| [ "${_USE_PROVIDER_DNS}" = "YES" ] \
|| [ ! -e "${_vBs}/resolv.conf.vanilla" ]; then
_fix_dns_settings
if [ -e "/etc/init.d/postfix" ]; then
service postfix restart &> /dev/null
fi
fi
fi
}
_find_fast_mirror_early() {
_isNetc=$(which netcat 2>&1)
if [ ! -x "${_isNetc}" ] || [ -z "${_isNetc}" ]; then
if [ ! -e "/etc/apt/apt.conf.d/00sandboxoff" ] \
&& [ -e "/etc/apt/apt.conf.d" ]; then
echo "APT::Sandbox::User \"root\";" > /etc/apt/apt.conf.d/00sandboxoff
fi
_apt_clean_update
apt-get install netcat ${_aptYesUnth} &> /dev/null
apt-get install netcat-traditional ${_aptYesUnth} &> /dev/null
fi
_ffMirr=$(which ffmirror 2>&1)
if [ -x "${_ffMirr}" ]; then
_ffList="/var/backups/boa-mirrors-2025-02.txt"
mkdir -p /var/backups
if [ ! -e "${_ffList}" ]; then
echo "eu.files.aegir.cc" > ${_ffList}
echo "us.files.aegir.cc" >> ${_ffList}
echo "ao.files.aegir.cc" >> ${_ffList}
fi
if [ -e "${_ffList}" ]; then
_BROKEN_FFMIRR_TEST=$(grep "stuff" ${_ffMirr} 2>&1)
if [[ "${_BROKEN_FFMIRR_TEST}" =~ "stuff" ]]; then
_CHECK_MIRROR=$(bash ${_ffMirr} < ${_ffList} 2>&1)
_USE_MIR="${_CHECK_MIRROR}"
[[ "${_USE_MIR}" =~ "printf" ]] && _USE_MIR="files.aegir.cc"
else
_USE_MIR="files.aegir.cc"
fi
else
_USE_MIR="files.aegir.cc"
fi
else
_USE_MIR="files.aegir.cc"
fi
_urlDev="http://${_USE_MIR}/dev"
_urlHmr="http://${_USE_MIR}/versions/${_tRee}/boa/aegir"
}
_extract_archive() {
if [ ! -z "$1" ]; then
case $1 in
*.tar.bz2) tar xjf $1 ;;
*.tar.gz) tar xzf $1 ;;
*.tar.xz) tar xvf $1 ;;
*.bz2) bunzip2 $1 ;;
*.rar) unrar x $1 ;;
*.gz) gunzip -q $1 ;;
*.tar) tar xf $1 ;;
*.tbz2) tar xjf $1 ;;
*.tgz) tar xzf $1 ;;
*.zip) unzip -qq $1 ;;
*.Z) uncompress $1 ;;
*.7z) 7z x $1 ;;
*) echo "'$1' cannot be extracted via >extract<" ;;
esac
rm -f $1
fi
}
#
# Download and extract from dev/contrib mirror.
_get_dev_contrib() {
if [ ! -z "$1" ]; then
_max_attempts=10
_attempt_num=1
_success=0
while [ ${_attempt_num} -le ${_max_attempts} ]; do
[ "${_DEBUG_MODE}" = "YES" ] && echo "DNLD: Attempt ${_attempt_num} of ${_max_attempts}: Downloading $1..."
if curl ${_crlGet} "${_urlDev}/${_tRee}/contrib/$1" -o "$1"; then
_success=1
break
else
[ "${_DEBUG_MODE}" = "YES" ] && echo "DNLD: Attempt ${_attempt_num} failed."
_attempt_num=$((_attempt_num+1))
if [ ${_attempt_num} -le ${_max_attempts} ]; then
[ "${_DEBUG_MODE}" = "YES" ] && echo "DNLD: Retrying in 9 seconds..."
sleep 9
fi
fi
done
if [ ${_success} -eq 1 ]; then
_extract_archive "$1"
else
echo "OOPS: Failed to download ${_urlDev}/${_tRee}/contrib/$1 after ${_max_attempts} attempts"
return 1 # Exit the function but continue the script
fi
fi
}
#
# Download and extract archive from dev/src mirror.
_get_dev_src() {
if [ ! -z "$1" ]; then
_max_attempts=10
_attempt_num=1
_success=0
while [ ${_attempt_num} -le ${_max_attempts} ]; do
[ "${_DEBUG_MODE}" = "YES" ] && echo "DNLD: Attempt ${_attempt_num} of ${_max_attempts}: Downloading $1..."
if curl ${_crlGet} "${_urlDev}/src/$1" -o "$1"; then
_success=1
break
else
[ "${_DEBUG_MODE}" = "YES" ] && echo "DNLD: Attempt ${_attempt_num} failed."
_attempt_num=$((_attempt_num+1))
if [ ${_attempt_num} -le ${_max_attempts} ]; then
[ "${_DEBUG_MODE}" = "YES" ] && echo "DNLD: Retrying in 9 seconds..."
sleep 9
fi
fi
done
if [ ${_success} -eq 1 ]; then
_extract_archive "$1"
else
echo "OOPS: Failed to download ${_urlDev}/src/$1 after ${_max_attempts} attempts"
return 1 # Exit the function but continue the script
fi
fi
}
_if_clean_boa_env() {
if [ ! -x "/etc/init.d/clean-boa-env" ]; then
curl ${_crlGet} "${_urlHmr}/conf/var/clean-boa-env" -o /etc/init.d/clean-boa-env
if [ -e "/etc/init.d/clean-boa-env" ]; then
chmod 700 /etc/init.d/clean-boa-env
chown root:root /etc/init.d/clean-boa-env
update-rc.d clean-boa-env defaults &> /dev/null
fi
fi
}
_locales_check_fix_early() {
_isLoc=$(which locale 2>&1)
if [ ! -x "${_isLoc}" ] || [ -z "${_isLoc}" ]; then
_INITINS="/usr/bin/apt-get ${_aptAllow} -y install"
apt-get update -qq &> /dev/null
${_INITINS} locales locales-all &> /dev/null
fi
_LOC_TEST=$(locale 2>&1)
if [[ "${_LOC_TEST}" =~ LANG=.*UTF-8 ]]; then
_LOCALE_TEST=OK
fi
if [[ "${_LOC_TEST}" =~ "Cannot" ]]; then
_LOCALE_TEST=BROKEN
fi
if [ "${_LOCALE_TEST}" = "BROKEN" ]; then
_LOCALE_GEN_TEST=$(grep -v "^#" /etc/locale.gen 2>&1)
if [[ ! "${_LOCALE_GEN_TEST}" =~ "en_US.UTF-8 UTF-8" ]]; then
echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen
fi
sed -i "/^$/d" /etc/locale.gen
locale-gen &> /dev/null
locale-gen en_US.UTF-8 &> /dev/null
# Explicitly enforce all locale settings
update-locale \
LANG=en_US.UTF-8 \
LC_CTYPE=en_US.UTF-8 \
LC_COLLATE=POSIX \
LC_NUMERIC=POSIX \
LC_TIME=en_US.UTF-8 \
LC_MONETARY=en_US.UTF-8 \
LC_MESSAGES=en_US.UTF-8 \
LC_PAPER=en_US.UTF-8 \
LC_NAME=en_US.UTF-8 \
LC_ADDRESS=en_US.UTF-8 \
LC_TELEPHONE=en_US.UTF-8 \
LC_MEASUREMENT=en_US.UTF-8 \
LC_IDENTIFICATION=en_US.UTF-8 \
LC_ALL= &> /dev/null
# Define all locale settings on the fly to prevent unnecessary
# warnings during installation of packages.
export LANG=en_US.UTF-8 &> /dev/null
export LC_CTYPE=en_US.UTF-8 &> /dev/null
export LC_COLLATE=POSIX &> /dev/null
export LC_NUMERIC=POSIX &> /dev/null
export LC_TIME=en_US.UTF-8 &> /dev/null
export LC_MONETARY=en_US.UTF-8 &> /dev/null
export LC_MESSAGES=en_US.UTF-8 &> /dev/null
export LC_PAPER=en_US.UTF-8 &> /dev/null
export LC_NAME=en_US.UTF-8 &> /dev/null
export LC_ADDRESS=en_US.UTF-8 &> /dev/null
export LC_TELEPHONE=en_US.UTF-8 &> /dev/null
export LC_MEASUREMENT=en_US.UTF-8 &> /dev/null
export LC_IDENTIFICATION=en_US.UTF-8 &> /dev/null
export LC_ALL= &> /dev/null
else
_LOCALE_GEN_TEST=$(grep -v "^#" /etc/locale.gen 2>&1)
if [[ ! "${_LOCALE_GEN_TEST}" =~ "en_US.UTF-8 UTF-8" ]]; then
echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen
fi
sed -i "/^$/d" /etc/locale.gen
locale-gen &> /dev/null
locale-gen en_US.UTF-8 &> /dev/null
# Explicitly enforce locale settings required for consistency
update-locale \
LANG=en_US.UTF-8 \
LC_CTYPE=en_US.UTF-8 \
LC_COLLATE=POSIX \
LC_NUMERIC=POSIX \
LC_ALL= &> /dev/null
# Define locale settings required for consistency also on the fly
export LC_COLLATE=POSIX &> /dev/null
export LC_NUMERIC=POSIX &> /dev/null
export LC_ALL= &> /dev/null
fi
_LOCALES_BASHRC_TEST=$(grep LC_COLLATE /root/.bashrc 2>&1)
if [[ ! "${_LOCALES_BASHRC_TEST}" =~ "LC_COLLATE" ]]; then
printf "\n" >> /root/.bashrc
echo "export LANG=en_US.UTF-8" >> /root/.bashrc
echo "export LC_CTYPE=en_US.UTF-8" >> /root/.bashrc
echo "export LC_COLLATE=POSIX" >> /root/.bashrc
echo "export LC_NUMERIC=POSIX" >> /root/.bashrc
echo "export LC_TIME=en_US.UTF-8" >> /root/.bashrc
echo "export LC_MONETARY=en_US.UTF-8" >> /root/.bashrc
echo "export LC_MESSAGES=en_US.UTF-8" >> /root/.bashrc
echo "export LC_PAPER=en_US.UTF-8" >> /root/.bashrc
echo "export LC_NAME=en_US.UTF-8" >> /root/.bashrc
echo "export LC_ADDRESS=en_US.UTF-8" >> /root/.bashrc
echo "export LC_TELEPHONE=en_US.UTF-8" >> /root/.bashrc
echo "export LC_MEASUREMENT=en_US.UTF-8" >> /root/.bashrc
echo "export LC_IDENTIFICATION=en_US.UTF-8" >> /root/.bashrc
echo "export LC_ALL=" >> /root/.bashrc
printf "\n" >> /root/.bashrc
fi
}
_if_fix_iptables_symlinks() {
###
### Fix for iptables paths backward compatibility
###
if [ -x "/sbin/iptables" ] && [ ! -e "/usr/sbin/iptables" ]; then
ln -s /sbin/iptables /usr/sbin/iptables
fi
if [ -x "/usr/sbin/iptables" ] && [ ! -e "/sbin/iptables" ]; then
ln -s /usr/sbin/iptables /sbin/iptables
fi
if [ -x "/sbin/iptables-save" ] && [ ! -e "/usr/sbin/iptables-save" ]; then
ln -s /sbin/iptables-save /usr/sbin/iptables-save
fi
if [ -x "/usr/sbin/iptables-save" ] && [ ! -e "/sbin/iptables-save" ]; then
ln -s /usr/sbin/iptables-save /sbin/iptables-save
fi
if [ -x "/sbin/iptables-restore" ] && [ ! -e "/usr/sbin/iptables-restore" ]; then
ln -s /sbin/iptables-restore /usr/sbin/iptables-restore
fi
if [ -x "/usr/sbin/iptables-restore" ] && [ ! -e "/sbin/iptables-restore" ]; then
ln -s /usr/sbin/iptables-restore /sbin/iptables-restore
fi
if [ -x "/sbin/ip6tables" ] && [ ! -e "/usr/sbin/ip6tables" ]; then
ln -s /sbin/ip6tables /usr/sbin/ip6tables
fi
if [ -x "/usr/sbin/ip6tables" ] && [ ! -e "/sbin/ip6tables" ]; then
ln -s /usr/sbin/ip6tables /sbin/ip6tables
fi
if [ -x "/sbin/ip6tables-save" ] && [ ! -e "/usr/sbin/ip6tables-save" ]; then
ln -s /sbin/ip6tables-save /usr/sbin/ip6tables-save
fi
if [ -x "/usr/sbin/ip6tables-save" ] && [ ! -e "/sbin/ip6tables-save" ]; then
ln -s /usr/sbin/ip6tables-save /sbin/ip6tables-save
fi
if [ -x "/sbin/ip6tables-restore" ] && [ ! -e "/usr/sbin/ip6tables-restore" ]; then
ln -s /sbin/ip6tables-restore /usr/sbin/ip6tables-restore
fi
if [ -x "/usr/sbin/ip6tables-restore" ] && [ ! -e "/sbin/ip6tables-restore" ]; then
ln -s /usr/sbin/ip6tables-restore /sbin/ip6tables-restore
fi
###
### Fix for iptables paths backward compatibility
###
}
_update_agents() {
_if_hosted_sys
if [ "${_hostedSys}" = "YES" ]; then
if [ ! -e "/root/.extended.firewall.exceptions.cnf" ]; then
echo host8 > /root/.extended.firewall.exceptions.cnf
fi
fi
if [ "${_VMFAMILY}" = "HOSTED" ] \
&& [ -e "/var/aegir/drush" ] \
&& [ -d "/data/u" ] \
&& [ -e "/var/xdrago" ]; then
[ ! -e "/root/.fast.cron.cnf" ] && echo ON > /root/.fast.cron.cnf
_PrTestPower=$(grep "POWER" /root/.*.octopus.cnf 2>&1)
_PrTestPhantom=$(grep "PHANTOM" /root/.*.octopus.cnf 2>&1)
_PrTestCluster=$(grep "CLUSTER" /root/.*.octopus.cnf 2>&1)
InTest=$(ls /data/disk/*/static/control/cli.info | wc -l 2>&1)
_SQL_PSWD=$(cat /root/.my.pass.txt 2>&1)
_SQL_PSWD=$(echo -n ${_SQL_PSWD} | tr -d "\n" 2>&1)
if [ "${InTest}" -lt "9" ] \
&& [[ ! "${_PrTestPower}" =~ "POWER" ]] \
&& [[ ! "${_PrTestPhantom}" =~ "PHANTOM" ]] \
&& [[ ! "${_PrTestCluster}" =~ "CLUSTER" ]]; then
[ ! -e "/root/.fast.cron.cnf" ] && echo ${InTest} > /root/.fast.cron.cnf
[ -e "/root/.hr.monitor.cnf" ] && rm -f /root/.hr.monitor.cnf
[ -e "/root/.slow.cron.cnf" ] && rm -f /root/.slow.cron.cnf
[ -e "/root/.tg.cnf" ] && rm -f /root/.tg.cnf
mysql -u root -e "SET GLOBAL max_connect_errors = 80;"
mysql -u root -e "SET GLOBAL max_connections = 100;"
mysql -u root -e "SET GLOBAL max_user_connections = 80;"
mysql -u root -e "SET GLOBAL group_concat_max_len = 10000;"
fi
if [ "${InTest}" -ge "9" ] && [ "${InTest}" -le "50" ]; then
[ ! -e "/root/.fast.cron.cnf" ] && echo ${InTest} > /root/.fast.cron.cnf
[ -e "/root/.hr.monitor.cnf" ] && rm -f /root/.hr.monitor.cnf
[ -e "/root/.slow.cron.cnf" ] && rm -f /root/.slow.cron.cnf
[ -e "/root/.tg.cnf" ] && rm -f /root/.tg.cnf
mysql -u root -e "SET GLOBAL max_connect_errors = 80;"
mysql -u root -e "SET GLOBAL max_connections = 200;"
mysql -u root -e "SET GLOBAL max_user_connections = 80;"
mysql -u root -e "SET GLOBAL group_concat_max_len = 10000;"
fi
if [ "${InTest}" -gt "50" ]; then
[ -e "/root/.fast.cron.cnf" ] && rm -f /root/.fast.cron.cnf
[ ! -e "/root/.tg.cnf" ] && echo ${InTest} > /root/.tg.cnf
[ ! -e "/root/.hr.monitor.cnf" ] && echo ${InTest} > /root/.hr.monitor.cnf
[ ! -e "/root/.slow.cron.cnf" ] && echo ${InTest} > /root/.slow.cron.cnf
mysql -u root -e "SET GLOBAL max_connect_errors = 80;"
mysql -u root -e "SET GLOBAL max_connections = 200;"
mysql -u root -e "SET GLOBAL max_user_connections = 80;"
mysql -u root -e "SET GLOBAL group_concat_max_len = 10000;"
fi
if [[ "${_PrTestPower}" =~ "POWER" ]]; then
[ ! -e "/root/.tg.cnf" ] && echo ${InTest} > /root/.tg.cnf
[ ! -e "/root/.fast.cron.cnf" ] && echo ${InTest} > /root/.fast.cron.cnf
[ -e "/root/.hr.monitor.cnf" ] && rm -f /root/.hr.monitor.cnf
[ -e "/root/.slow.cron.cnf" ] && rm -f /root/.slow.cron.cnf
mysql -u root -e "SET GLOBAL max_connect_errors = 150;"
mysql -u root -e "SET GLOBAL max_connections = 200;"
mysql -u root -e "SET GLOBAL max_user_connections = 150;"
mysql -u root -e "SET GLOBAL group_concat_max_len = 10000;"
fi
if [[ "${_PrTestPhantom}" =~ "PHANTOM" ]]; then
[ ! -e "/root/.tg.cnf" ] && echo ${InTest} > /root/.tg.cnf
[ ! -e "/root/.fast.cron.cnf" ] && echo ${InTest} > /root/.fast.cron.cnf
[ -e "/root/.hr.monitor.cnf" ] && rm -f /root/.hr.monitor.cnf
[ -e "/root/.slow.cron.cnf" ] && rm -f /root/.slow.cron.cnf
mysql -u root -e "SET GLOBAL max_connect_errors = 150;"
mysql -u root -e "SET GLOBAL max_connections = 200;"
mysql -u root -e "SET GLOBAL max_user_connections = 150;"
mysql -u root -e "SET GLOBAL group_concat_max_len = 10000;"
fi
if [[ "${_PrTestCluster}" =~ "CLUSTER" ]]; then
[ ! -e "/root/.tg.cnf" ] && echo ${InTest} > /root/.tg.cnf
[ ! -e "/root/.fast.cron.cnf" ] && echo ${InTest} > /root/.fast.cron.cnf
[ -e "/root/.hr.monitor.cnf" ] && rm -f /root/.hr.monitor.cnf
[ -e "/root/.slow.cron.cnf" ] && rm -f /root/.slow.cron.cnf
mysql -u root -e "SET GLOBAL max_connect_errors = 150;"
mysql -u root -e "SET GLOBAL max_connections = 200;"
mysql -u root -e "SET GLOBAL max_user_connections = 150;"
mysql -u root -e "SET GLOBAL group_concat_max_len = 10000;"
fi
mysql -u root -e "SET GLOBAL optimizer_switch='derived_merge=off';"
mysql -u root -e "SET GLOBAL sort_buffer_size = 262144;"
if [ -e "/root/.tg.cnf" ]; then
if [ ! -e "/root/.fixed_fpm_workers.pid" ]; then
sed -i "s/^_PHP_FPM_WORKERS=.*/_PHP_FPM_WORKERS=100/g" ${_barCnf}
touch /root/.fixed_fpm_workers.pid
fi
fi
if [ ! -e "/root/.high_traffic.cnf" ]; then
echo ${InTest} > /root/.high_traffic.cnf
echo ${InTest} > /root/.no.swap.clear.cnf
fi
if [ "${_RANDOMIZE}" = "YES" ]; then
if [ ! -e "/root/.randomize_duplicity_full_backup_day.cnf" ]; then
echo ${InTest} > /root/.randomize_duplicity_full_backup_day.cnf
fi
if [ ! -e "/root/.skip_duplicity_monthly_cleanup.cnf" ]; then
echo ${InTest} > /root/.skip_duplicity_monthly_cleanup.cnf
fi
else
[ -e "/root/.randomize_duplicity_full_backup_day.cnf" ] && rm -f /root/.randomize_duplicity_full_backup_day.cnf
[ -e "/root/.skip_duplicity_monthly_cleanup.cnf" ] && rm -f /root/.skip_duplicity_monthly_cleanup.cnf
fi
[ -e "/root/.my.batch_innodb.cnf" ] && rm -f /root/.my.batch_innodb.cnf
[ -e "/root/.batch_innodb.cnf" ] && rm -f /root/.batch_innodb.cnf
[ -e "/root/.force.drupalgeddon.cnf" ] && rm -f /root/.force.drupalgeddon.cnf
[ -e "/root/.skip_cleanup.cnf" ] && rm -f /root/.skip_cleanup.cnf
[ -e "/root/.giant_traffic.cnf" ] && rm -f /root/.giant_traffic.cnf
[ -e "/root/.default.cnf" ] && rm -f /root/.default.cnf
[ -e "/root/.debug.cnf" ] && rm -f /root/.debug.cnf
if [ -e "/data/conf/override.global.inc" ] \
&& [ ! -e "/data/conf/.prev6.override.global.inc.off" ]; then
mv -f /data/conf/override.global.inc /data/conf/.prev6.override.global.inc.off
fi
# if [ ! -e "/data/conf/override.global.inc" ]; then
# echo "<?php" > /data/conf/override.global.inc.tmp
# echo "" >> /data/conf/override.global.inc.tmp
# echo "\$use_redis = TRUE;" >> /data/conf/override.global.inc.tmp
# chmod 644 /data/conf/override.global.inc.tmp
# mv -f /data/conf/override.global.inc.tmp /data/conf/override.global.inc
# fi
fi
if [ -e "/var/aegir/drush" ]; then
[ ! -e "/var/xdrago/monitor/check" ] && mkdir -p /var/xdrago/monitor/check
[ ! -e "/var/xdrago/monitor/log" ] && mkdir -p /var/xdrago/monitor/log
[ ! -e "/var/xdrago/checksql.pl" ] && rm -f ${_pthLog}/checksql.pl.ctrl.*.pid
[ ! -e "/var/xdrago/clear.sh" ] && rm -f ${_pthLog}/clear.sh.ctrl.*.pid
[ ! -e "/var/xdrago/daily.sh" ] && rm -f ${_pthLog}/daily.sh.ctrl.*.pid
[ ! -e "/var/xdrago/graceful.sh" ] && rm -f ${_pthLog}/graceful.sh.ctrl.*.pid
[ ! -e "/var/xdrago/guest-fire.sh" ] && rm -f ${_pthLog}/guest-fire.sh.ctrl.*.pid
[ ! -e "/var/xdrago/guest-water.sh" ] && rm -f ${_pthLog}/guest-water.sh.ctrl.*.pid
[ ! -e "/var/xdrago/ip_access.sh" ] && rm -f ${_pthLog}/ip_access.sh.ctrl.*.pid
[ ! -e "/var/xdrago/manage_ltd_users.sh" ] && rm -f ${_pthLog}/manage_ltd_users.sh.ctrl.*.pid
[ ! -e "/var/xdrago/manage_solr_config.sh" ] && rm -f ${_pthLog}/manage_solr_config.sh.ctrl.*.pid
[ ! -e "/var/xdrago/minute.sh" ] && rm -f ${_pthLog}/minute.sh.ctrl.*.pid
[ ! -e "/var/xdrago/move_sql.sh" ] && rm -f ${_pthLog}/move_sql.sh.ctrl.*.pid
[ ! -e "/var/xdrago/mysql_backup.sh" ] && rm -f ${_pthLog}/mysql_backup.sh.ctrl.*.pid
[ ! -e "/var/xdrago/mysql_cleanup.sh" ] && rm -f ${_pthLog}/mysql_cleanup.sh.ctrl.*.pid
[ ! -e "/var/xdrago/mysql_cluster_backup.sh" ] && rm -f ${_pthLog}/mysql_cluster_backup.sh.ctrl.*.pid
[ ! -e "/var/xdrago/mysql_repair.sh" ] && rm -f ${_pthLog}/mysql_repair.sh.ctrl.*.pid
[ ! -e "/var/xdrago/proc_num_ctrl.pl" ] && rm -f ${_pthLog}/proc_num_ctrl.pl.ctrl.*.pid
[ ! -e "/var/xdrago/purge_binlogs.sh" ] && rm -f ${_pthLog}/purge_binlogs.sh.ctrl.*.pid
[ ! -e "/var/xdrago/runner.sh" ] && rm -f ${_pthLog}/runner.sh.ctrl.*.pid
[ ! -e "/var/xdrago/second.sh" ] && rm -f ${_pthLog}/second.sh.ctrl.*.pid
[ ! -e "/var/xdrago/usage.sh" ] && rm -f ${_pthLog}/usage.sh.ctrl.*.pid
[ ! -e "/var/xdrago/monitor/check/java.sh" ] && rm -f ${_pthLog}/java.sh.ctrl.*.pid
[ ! -e "/var/xdrago/monitor/check/mysql.sh" ] && rm -f ${_pthLog}/mysql.sh.ctrl.*.pid
[ ! -e "/var/xdrago/monitor/check/nginx.sh" ] && rm -f ${_pthLog}/nginx.sh.ctrl.*.pid
[ ! -e "/var/xdrago/monitor/check/php.sh" ] && rm -f ${_pthLog}/php.sh.ctrl.*.pid
[ ! -e "/var/xdrago/monitor/check/redis.sh" ] && rm -f ${_pthLog}/redis.sh.ctrl.*.pid
[ ! -e "/var/xdrago/monitor/check/scan_nginx.sh" ] && rm -f ${_pthLog}/scan_nginx.sh.ctrl.*.pid
[ ! -e "/var/xdrago/monitor/check/system.sh" ] && rm -f ${_pthLog}/system.sh.ctrl.*.pid
[ ! -e "/var/xdrago/monitor/check/unbound.sh" ] && rm -f ${_pthLog}/unbound.sh.ctrl.*.pid
[ ! -e "/var/xdrago/monitor/check/escapecheck.pl" ] && rm -f ${_pthLog}/escapecheck.pl.ctrl.*.pid
[ ! -e "/var/xdrago/monitor/check/hackcheck.pl" ] && rm -f ${_pthLog}/hackcheck.pl.ctrl.*.pid
[ ! -e "/var/xdrago/monitor/check/hackftp.pl" ] && rm -f ${_pthLog}/hackftp.pl.ctrl.*.pid
[ ! -e "/var/xdrago/monitor/check/locked_java.pl" ] && rm -f ${_pthLog}/locked_java.pl.ctrl.*.pid
[ ! -e "/var/xdrago/monitor/check/locked_nginx.pl" ] && rm -f ${_pthLog}/locked_nginx.pl.ctrl.*.pid
[ ! -e "/var/xdrago/monitor/check/scan_nginx.pl" ] && rm -f ${_pthLog}/scan_nginx.pl.ctrl.*.pid
[ ! -e "/var/xdrago/monitor/check/segfault_alert.pl" ] && rm -f ${_pthLog}/segfault_alert.pl.ctrl.*.pid
[ ! -e "/var/xdrago/monitor/check/sqlcheck.pl" ] && rm -f ${_pthLog}/sqlcheck.pl.ctrl.*.pid
[ -e "/var/xdrago/proc_num_ctrl.cgi" ] && rm -f /var/xdrago/proc_num_ctrl.cgi
[ -e "/var/xdrago/checksql.cgi" ] && rm -f /var/xdrago/checksql.cgi
[ -e "/var/xdrago/mysql_hourly.sh" ] && rm -f /var/xdrago/mysql_hourly.sh
[ -e "/var/xdrago/monitor/check/sqlcheck" ] && rm -f ${_pthLog}/*.ctrl.*.pid
[ -e "/var/xdrago/monitor/check/sqlcheck" ] && rm -f /var/xdrago/monitor/check/*
[ -e "/var/xdrago/monitor/hackcheck.archive.log" ] && rm -f /var/xdrago/monitor/.scan_nginx_arch*
[ -e "/var/xdrago/monitor/hackcheck.archive.log" ] && mv -f /var/xdrago/monitor/*.log /var/xdrago/monitor/log/
fi
if [ -e "/var/xdrago/monitor/check" ] \
&& [ -e "/var/aegir/drush" ] \
&& [ ! -e "${_pthLog}/scan_nginx.sh.ctrl.f95.${_tRee}.${_xSrl}.pid" ]; then
mv -f /var/xdrago/monitor/check/scan_nginx.sh /var/xdrago/monitor/check/scan_nginx.sh.old
curl ${_crlGet} "${_urlHmr}/tools/system/monitor/check/scan_nginx.sh" -o /var/xdrago/monitor/check/scan_nginx.sh
if [ -e "/var/xdrago/monitor/check/scan_nginx.sh" ]; then
chmod 700 /var/xdrago/monitor/check/scan_nginx.sh
chown root:root /var/xdrago/monitor/check/scan_nginx.sh
touch ${_pthLog}/scan_nginx.sh.ctrl.f95.${_tRee}.${_xSrl}.pid
else
mv -f /var/xdrago/monitor/check/scan_nginx.sh.old /var/xdrago/monitor/check/scan_nginx.sh
fi
fi
if [ -e "/var/xdrago/monitor/check" ] \
&& [ -e "/var/aegir/drush" ] \
&& [ ! -e "${_pthLog}/java.sh.ctrl.f95.${_tRee}.${_xSrl}.pid" ]; then
mv -f /var/xdrago/monitor/check/java.sh /var/xdrago/monitor/check/java.sh.old
curl ${_crlGet} "${_urlHmr}/tools/system/monitor/check/java.sh" -o /var/xdrago/monitor/check/java.sh
if [ -e "/var/xdrago/monitor/check/java.sh" ]; then
chmod 700 /var/xdrago/monitor/check/java.sh
chown root:root /var/xdrago/monitor/check/java.sh
touch ${_pthLog}/java.sh.ctrl.f95.${_tRee}.${_xSrl}.pid
else
mv -f /var/xdrago/monitor/check/java.sh.old /var/xdrago/monitor/check/java.sh
fi
fi
if [ -e "/var/xdrago/monitor/check" ] \
&& [ -e "/var/aegir/drush" ] \
&& [ ! -e "${_pthLog}/mysql.sh.ctrl.f95.${_tRee}.${_xSrl}.pid" ]; then
mv -f /var/xdrago/monitor/check/mysql.sh /var/xdrago/monitor/check/mysql.sh.old
curl ${_crlGet} "${_urlHmr}/tools/system/monitor/check/mysql.sh" -o /var/xdrago/monitor/check/mysql.sh
if [ -e "/var/xdrago/monitor/check/mysql.sh" ]; then
if [ -e "/root/.debug.cnf" ] && [ ! -e "/root/.default.cnf" ]; then
_DO_NOTHING=YES
else
if [ -e "/root/.high_load.cnf" ] \
&& [ ! -e "/root/.big_db.cnf" ] \
&& [ ! -e "/root/.tg.cnf" ]; then
sed -i "s/3600/300/g" /var/xdrago/monitor/check/mysql.sh
elif [ -e "/root/.big_db.cnf" ] || [ -e "/root/.tg.cnf" ]; then
_DO_NOTHING=YES
else
sed -i "s/3600/1800/g" /var/xdrago/monitor/check/mysql.sh
fi
fi
chmod 700 /var/xdrago/monitor/check/mysql.sh
chown root:root /var/xdrago/monitor/check/mysql.sh
touch ${_pthLog}/mysql.sh.ctrl.f95.${_tRee}.${_xSrl}.pid
else
mv -f /var/xdrago/monitor/check/mysql.sh.old /var/xdrago/monitor/check/mysql.sh
fi
fi
if [ -e "/var/xdrago/monitor/check" ] \
&& [ -e "/var/aegir/drush" ] \
&& [ ! -e "${_pthLog}/nginx.sh.ctrl.f95.${_tRee}.${_xSrl}.pid" ]; then
mv -f /var/xdrago/monitor/check/nginx.sh /var/xdrago/monitor/check/nginx.sh.old
curl ${_crlGet} "${_urlHmr}/tools/system/monitor/check/nginx.sh" -o /var/xdrago/monitor/check/nginx.sh
if [ -e "/var/xdrago/monitor/check/nginx.sh" ]; then
chmod 700 /var/xdrago/monitor/check/nginx.sh
chown root:root /var/xdrago/monitor/check/nginx.sh
touch ${_pthLog}/nginx.sh.ctrl.f95.${_tRee}.${_xSrl}.pid
else
mv -f /var/xdrago/monitor/check/nginx.sh.old /var/xdrago/monitor/check/nginx.sh
fi
fi
if [ -e "/var/xdrago/monitor/check" ] \
&& [ -e "/var/aegir/drush" ] \
&& [ ! -e "${_pthLog}/php.sh.ctrl.f95.${_tRee}.${_xSrl}.pid" ]; then
mv -f /var/xdrago/monitor/check/php.sh /var/xdrago/monitor/check/php.sh.old
curl ${_crlGet} "${_urlHmr}/tools/system/monitor/check/php.sh" -o /var/xdrago/monitor/check/php.sh
if [ -e "/var/xdrago/monitor/check/php.sh" ]; then
chmod 700 /var/xdrago/monitor/check/php.sh
chown root:root /var/xdrago/monitor/check/php.sh
touch ${_pthLog}/php.sh.ctrl.f95.${_tRee}.${_xSrl}.pid
else
mv -f /var/xdrago/monitor/check/php.sh.old /var/xdrago/monitor/check/php.sh
fi
fi
if [ -e "/var/xdrago/monitor/check" ] \
&& [ -e "/var/aegir/drush" ] \
&& [ ! -e "${_pthLog}/redis.sh.ctrl.f95.${_tRee}.${_xSrl}.pid" ]; then
mv -f /var/xdrago/monitor/check/redis.sh /var/xdrago/monitor/check/redis.sh.old
curl ${_crlGet} "${_urlHmr}/tools/system/monitor/check/redis.sh" -o /var/xdrago/monitor/check/redis.sh
if [ -e "/var/xdrago/monitor/check/redis.sh" ]; then
chmod 700 /var/xdrago/monitor/check/redis.sh
chown root:root /var/xdrago/monitor/check/redis.sh
touch ${_pthLog}/redis.sh.ctrl.f95.${_tRee}.${_xSrl}.pid
else
mv -f /var/xdrago/monitor/check/redis.sh.old /var/xdrago/monitor/check/redis.sh
fi
fi
if [ -e "/var/xdrago/monitor/check" ] \
&& [ -e "/var/aegir/drush" ] \
&& [ ! -e "${_pthLog}/system.sh.ctrl.f93.${_tRee}.${_xSrl}.pid" ]; then
mv -f /var/xdrago/monitor/check/system.sh /var/xdrago/monitor/check/system.sh.old
curl ${_crlGet} "${_urlHmr}/tools/system/monitor/check/system.sh" -o /var/xdrago/monitor/check/system.sh
if [ -e "/var/xdrago/monitor/check/system.sh" ]; then
chmod 700 /var/xdrago/monitor/check/system.sh
chown root:root /var/xdrago/monitor/check/system.sh
touch ${_pthLog}/system.sh.ctrl.f93.${_tRee}.${_xSrl}.pid
else
mv -f /var/xdrago/monitor/check/system.sh.old /var/xdrago/monitor/check/system.sh
fi
fi
if [ -e "/var/xdrago/monitor/check" ] \
&& [ -e "/var/aegir/drush" ] \
&& [ ! -e "${_pthLog}/unbound.sh.ctrl.f95.${_tRee}.${_xSrl}.pid" ]; then
mv -f /var/xdrago/monitor/check/unbound.sh /var/xdrago/monitor/check/unbound.sh.old
curl ${_crlGet} "${_urlHmr}/tools/system/monitor/check/unbound.sh" -o /var/xdrago/monitor/check/unbound.sh
if [ -e "/var/xdrago/monitor/check/unbound.sh" ]; then
chmod 700 /var/xdrago/monitor/check/unbound.sh
chown root:root /var/xdrago/monitor/check/unbound.sh
touch ${_pthLog}/unbound.sh.ctrl.f95.${_tRee}.${_xSrl}.pid
else
mv -f /var/xdrago/monitor/check/unbound.sh.old /var/xdrago/monitor/check/unbound.sh
fi
fi
if [ -e "/var/xdrago/monitor/check" ] \
&& [ -e "/var/aegir/drush" ] \
&& [ ! -e "${_pthLog}/escapecheck.pl.ctrl.f95.${_tRee}.${_xSrl}.pid" ]; then
mv -f /var/xdrago/monitor/check/escapecheck.pl /var/xdrago/monitor/check/escapecheck.pl.old
curl ${_crlGet} "${_urlHmr}/tools/system/monitor/check/escapecheck.pl" -o /var/xdrago/monitor/check/escapecheck.pl
if [ -e "/var/xdrago/monitor/check/escapecheck.pl" ]; then
chmod 700 /var/xdrago/monitor/check/escapecheck.pl
chown root:root /var/xdrago/monitor/check/escapecheck.pl
touch ${_pthLog}/escapecheck.pl.ctrl.f95.${_tRee}.${_xSrl}.pid
else
mv -f /var/xdrago/monitor/check/escapecheck.pl.old /var/xdrago/monitor/check/escapecheck.pl
fi
fi
if [ -e "/var/xdrago/monitor/check" ] \
&& [ -e "/var/aegir/drush" ] \
&& [ ! -e "${_pthLog}/hackcheck.pl.ctrl.f95.${_tRee}.${_xSrl}.pid" ]; then
mv -f /var/xdrago/monitor/check/hackcheck.pl /var/xdrago/monitor/check/hackcheck.pl.old
curl ${_crlGet} "${_urlHmr}/tools/system/monitor/check/hackcheck.pl" -o /var/xdrago/monitor/check/hackcheck.pl
if [ -e "/var/xdrago/monitor/check/hackcheck.pl" ]; then
chmod 700 /var/xdrago/monitor/check/hackcheck.pl
chown root:root /var/xdrago/monitor/check/hackcheck.pl
touch ${_pthLog}/hackcheck.pl.ctrl.f95.${_tRee}.${_xSrl}.pid
else
mv -f /var/xdrago/monitor/check/hackcheck.pl.old /var/xdrago/monitor/check/hackcheck.pl
fi
fi
if [ -e "/var/xdrago/monitor/check" ] \
&& [ -e "/var/aegir/drush" ] \
&& [ ! -e "${_pthLog}/hackftp.pl.ctrl.f95.${_tRee}.${_xSrl}.pid" ]; then
mv -f /var/xdrago/monitor/check/hackftp.pl /var/xdrago/monitor/check/hackftp.pl.old
curl ${_crlGet} "${_urlHmr}/tools/system/monitor/check/hackftp.pl" -o /var/xdrago/monitor/check/hackftp.pl
if [ -e "/var/xdrago/monitor/check/hackftp.pl" ]; then
chmod 700 /var/xdrago/monitor/check/hackftp.pl
chown root:root /var/xdrago/monitor/check/hackftp.pl
touch ${_pthLog}/hackftp.pl.ctrl.f95.${_tRee}.${_xSrl}.pid
else
mv -f /var/xdrago/monitor/check/hackftp.pl.old /var/xdrago/monitor/check/hackftp.pl
fi
fi
if [ -e "/var/xdrago/monitor/check" ] \
&& [ -e "/var/aegir/drush" ] \
&& [ ! -e "${_pthLog}/locked_java.pl.ctrl.f95.${_tRee}.${_xSrl}.pid" ]; then
mv -f /var/xdrago/monitor/check/locked_java.pl /var/xdrago/monitor/check/locked_java.pl.old
curl ${_crlGet} "${_urlHmr}/tools/system/monitor/check/locked_java.pl" -o /var/xdrago/monitor/check/locked_java.pl
if [ -e "/var/xdrago/monitor/check/locked_java.pl" ]; then
chmod 700 /var/xdrago/monitor/check/locked_java.pl
chown root:root /var/xdrago/monitor/check/locked_java.pl
touch ${_pthLog}/locked_java.pl.ctrl.f95.${_tRee}.${_xSrl}.pid
else
mv -f /var/xdrago/monitor/check/locked_java.pl.old /var/xdrago/monitor/check/locked_java.pl
fi
fi
if [ -e "/var/xdrago/monitor/check" ] \
&& [ -e "/var/aegir/drush" ] \
&& [ ! -e "${_pthLog}/locked_nginx.pl.ctrl.f95.${_tRee}.${_xSrl}.pid" ]; then
mv -f /var/xdrago/monitor/check/locked_nginx.pl /var/xdrago/monitor/check/locked_nginx.pl.old
curl ${_crlGet} "${_urlHmr}/tools/system/monitor/check/locked_nginx.pl" -o /var/xdrago/monitor/check/locked_nginx.pl
if [ -e "/var/xdrago/monitor/check/locked_nginx.pl" ]; then
chmod 700 /var/xdrago/monitor/check/locked_nginx.pl
chown root:root /var/xdrago/monitor/check/locked_nginx.pl
touch ${_pthLog}/locked_nginx.pl.ctrl.f95.${_tRee}.${_xSrl}.pid
else
mv -f /var/xdrago/monitor/check/locked_nginx.pl.old /var/xdrago/monitor/check/locked_nginx.pl
fi
fi
if [ -e "/var/xdrago/monitor/check" ] \
&& [ -e "/var/aegir/drush" ] \
&& [ ! -e "${_pthLog}/segfault_alert.pl.ctrl.f95.${_tRee}.${_xSrl}.pid" ]; then
mv -f /var/xdrago/monitor/check/segfault_alert.pl /var/xdrago/monitor/check/segfault_alert.pl.old
curl ${_crlGet} "${_urlHmr}/tools/system/monitor/check/segfault_alert.pl" -o /var/xdrago/monitor/check/segfault_alert.pl
if [ -e "/var/xdrago/monitor/check/segfault_alert.pl" ]; then
chmod 700 /var/xdrago/monitor/check/segfault_alert.pl
chown root:root /var/xdrago/monitor/check/segfault_alert.pl
touch ${_pthLog}/segfault_alert.pl.ctrl.f95.${_tRee}.${_xSrl}.pid
else
mv -f /var/xdrago/monitor/check/segfault_alert.pl.old /var/xdrago/monitor/check/segfault_alert.pl
fi
fi
if [ -e "/var/xdrago/monitor/check" ] \
&& [ -e "/var/aegir/drush" ] \
&& [ ! -e "${_pthLog}/sqlcheck.pl.ctrl.f95.${_tRee}.${_xSrl}.pid" ]; then
mv -f /var/xdrago/monitor/check/sqlcheck.pl /var/xdrago/monitor/check/sqlcheck.pl.old
curl ${_crlGet} "${_urlHmr}/tools/system/monitor/check/sqlcheck.pl" -o /var/xdrago/monitor/check/sqlcheck.pl
if [ -e "/var/xdrago/monitor/check/sqlcheck.pl" ]; then
chmod 700 /var/xdrago/monitor/check/sqlcheck.pl
chown root:root /var/xdrago/monitor/check/sqlcheck.pl
touch ${_pthLog}/sqlcheck.pl.ctrl.f95.${_tRee}.${_xSrl}.pid
else
mv -f /var/xdrago/monitor/check/sqlcheck.pl.old /var/xdrago/monitor/check/sqlcheck.pl
fi
fi
if [ -e "/var/xdrago/monitor/check" ] \
&& [ ! -e "${_pthLog}/drush8-symlink.ctrl.${_tRee}.${_xSrl}.pid" ]; then
if [ -x "/opt/tools/drush/8/drush/drush.php" ] \
&& [ -L "/usr/bin/drush8" ]; then
_DRUSH_SYMLINK=$(readlink -n /usr/bin/drush8 2>&1)
_DRUSH_SYMLINK=$(echo -n ${_DRUSH_SYMLINK} | tr -d "\n" 2>&1)
if [ "${_DRUSH_SYMLINK}" != "/opt/tools/drush/8/drush/drush.php" ]; then
rm -f /usr/bin/drush8
rm -f /usr/bin/drush
ln -s /opt/tools/drush/8/drush/drush.php /usr/bin/drush8
ln -s /opt/tools/drush/8/drush/drush.php /usr/bin/drush
touch ${_pthLog}/drush8-symlink.ctrl.${_tRee}.${_xSrl}.pid
fi
fi
fi
if [ -e "/var/xdrago/monitor/check" ] \
&& [ -e "/var/aegir/drush" ] \
&& [ ! -e "${_pthLog}/clean-boa-env.ctrl.${_tRee}.${_xSrl}.pid" ]; then
mv -f /etc/init.d/clean-boa-env /var/xdrago/clean-boa-env.old
curl ${_crlGet} "${_urlHmr}/conf/var/clean-boa-env" -o /etc/init.d/clean-boa-env
if [ -e "/etc/init.d/clean-boa-env" ]; then
chmod 700 /etc/init.d/clean-boa-env
chown root:root /etc/init.d/clean-boa-env
touch ${_pthLog}/clean-boa-env.ctrl.${_tRee}.${_xSrl}.pid
else
mv -f /var/xdrago/clean-boa-env.old /etc/init.d/clean-boa-env
fi
fi
if [ -e "/var/xdrago/monitor/check" ] \
&& [ -e "/var/aegir/drush" ] \
&& [ ! -e "${_pthLog}/mysql_backup.sh.ctrl.f95.${_xSrl}.pid" ]; then
mv -f /var/xdrago/mysql_backup.sh /var/xdrago/mysql_backup.sh.old
curl ${_crlGet} "${_urlHmr}/tools/system/mysql_backup.sh" -o /var/xdrago/mysql_backup.sh
if [ -e "/var/xdrago/mysql_backup.sh" ]; then
chmod 700 /var/xdrago/mysql_backup.sh
chown root:root /var/xdrago/mysql_backup.sh
touch ${_pthLog}/mysql_backup.sh.ctrl.f95.${_xSrl}.pid
else
mv -f /var/xdrago/mysql_backup.sh.old /var/xdrago/mysql_backup.sh
fi
fi
if [ -e "/var/xdrago/monitor/check" ] \
&& [ -e "/var/aegir/drush" ] \
&& [ ! -e "${_pthLog}/unbound-helper.ctrl.f95.${_xSrl}.pid" ]; then
mv -f /usr/libexec/unbound-helper /usr/libexec/unbound-helper.old
curl ${_crlGet} "${_urlHmr}/conf/dns/unbound-helper" -o /usr/libexec/unbound-helper
if [ -e "/usr/libexec/unbound-helper" ]; then
chmod 755 /usr/libexec/unbound-helper
chown root:root /usr/libexec/unbound-helper
touch ${_pthLog}/unbound-helper.ctrl.f95.${_xSrl}.pid
else
mv -f /usr/libexec/unbound-helper.old /usr/libexec/unbound-helper
fi
fi
if [ -e "/var/xdrago/monitor/check" ] \
&& [ -e "/var/aegir/drush" ] \
&& [ ! -e "${_pthLog}/mysql_cleanup.sh.ctrl.f95.${_xSrl}.pid" ]; then
mv -f /var/xdrago/mysql_cleanup.sh /var/xdrago/mysql_cleanup.sh.old
curl ${_crlGet} "${_urlHmr}/tools/system/mysql_cleanup.sh" -o /var/xdrago/mysql_cleanup.sh
if [ -e "/var/xdrago/mysql_cleanup.sh" ]; then
chmod 700 /var/xdrago/mysql_cleanup.sh
chown root:root /var/xdrago/mysql_cleanup.sh
touch ${_pthLog}/mysql_cleanup.sh.ctrl.f95.${_xSrl}.pid
else
mv -f /var/xdrago/mysql_cleanup.sh.old /var/xdrago/mysql_cleanup.sh
fi
fi
if [ -e "/var/xdrago/monitor/check" ] \
&& [ -e "/var/aegir/drush" ] \
&& [ ! -e "${_pthLog}/mysql_cluster_backup.sh.ctrl.f95.${_tRee}.${_xSrl}.pid" ]; then
mv -f /var/xdrago/mysql_cluster_backup.sh /var/xdrago/mysql_cluster_backup.sh.old
curl ${_crlGet} "${_urlHmr}/tools/system/mysql_cluster_backup.sh" -o /var/xdrago/mysql_cluster_backup.sh
if [ -e "/var/xdrago/mysql_cluster_backup.sh" ]; then
chmod 700 /var/xdrago/mysql_cluster_backup.sh
chown root:root /var/xdrago/mysql_cluster_backup.sh
touch ${_pthLog}/mysql_cluster_backup.sh.ctrl.f95.${_tRee}.${_xSrl}.pid
else
mv -f /var/xdrago/mysql_cluster_backup.sh.old /var/xdrago/mysql_cluster_backup.sh
fi
fi
if [ -e "/var/xdrago/monitor/check" ] \
&& [ -e "/var/aegir/drush" ] \
&& [ ! -e "${_pthLog}/runner.sh.ctrl.f95.${_tRee}.${_xSrl}.pid" ]; then
mv -f /var/xdrago/runner.sh /var/xdrago/runner.sh.old
curl ${_crlGet} "${_urlHmr}/tools/system/runner.sh" -o /var/xdrago/runner.sh
if [ -e "/var/xdrago/runner.sh" ]; then
chmod 700 /var/xdrago/runner.sh
chown root:root /var/xdrago/runner.sh
touch ${_pthLog}/runner.sh.ctrl.f95.${_tRee}.${_xSrl}.pid
else
mv -f /var/xdrago/runner.sh.old /var/xdrago/runner.sh
fi
fi
if [ -e "/var/xdrago/monitor/check" ] \
&& [ -e "/var/aegir/drush" ] \
&& [ ! -e "${_pthLog}/minute.sh.ctrl.f95.${_tRee}.${_xSrl}.pid" ]; then
mv -f /var/xdrago/minute.sh /var/xdrago/minute.sh.old
curl ${_crlGet} "${_urlHmr}/tools/system/minute.sh" -o /var/xdrago/minute.sh
if [ -e "/var/xdrago/minute.sh" ]; then
chmod 700 /var/xdrago/minute.sh
chown root:root /var/xdrago/minute.sh
touch ${_pthLog}/minute.sh.ctrl.f95.${_tRee}.${_xSrl}.pid
else
mv -f /var/xdrago/minute.sh.old /var/xdrago/minute.sh
fi
fi