mirror of
https://github.com/midoks/mdserver-web.git
synced 2026-10-10 04:29:25 +08:00
Compare commits
797
Commits
0.18.2
..
2fe17aefd9
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2fe17aefd9 | ||
|
|
acddca54cd | ||
|
|
7d80fb31ce | ||
|
|
8ac1d78053 | ||
|
|
468d6d7752 | ||
|
|
f49d789411 | ||
|
|
1f56115fbb | ||
|
|
20d277102e | ||
|
|
47b4036f09 | ||
|
|
ee9e154fec | ||
|
|
85256b4fb6 | ||
|
|
16be671f1d | ||
|
|
af880115ab | ||
|
|
e64ac8f616 | ||
|
|
a7d4206b77 | ||
|
|
5a80690404 | ||
|
|
9b0d71d4ac | ||
|
|
729f77d8db | ||
|
|
e89f96aa2d | ||
|
|
f05f81cace | ||
|
|
f4883ee708 | ||
|
|
043fb739d9 | ||
|
|
b19aa8702b | ||
|
|
f4e0744879 | ||
|
|
d7c822f86d | ||
|
|
c8f8e217e5 | ||
|
|
bfec7f1fe8 | ||
|
|
21fce1f618 | ||
|
|
b5987b57ad | ||
|
|
e8c1cb08a7 | ||
|
|
0de3a16898 | ||
|
|
278bd7f38e | ||
|
|
4a3b9db324 | ||
|
|
b3e8e96875 | ||
|
|
f5e50c6d76 | ||
|
|
c551c2ee1a | ||
|
|
3fb8406e7b | ||
|
|
50d12407c9 | ||
|
|
17931bb0ea | ||
|
|
6d30940920 | ||
|
|
3a4c985baf | ||
|
|
960d8b6cb8 | ||
|
|
9b7e9d4ffa | ||
|
|
c1a646c0d7 | ||
|
|
48ef0e7a65 | ||
|
|
8dff306a91 | ||
|
|
a935acbc95 | ||
|
|
b1f9c99eb1 | ||
|
|
0851f749c3 | ||
|
|
3a7d9f84c7 | ||
|
|
b43b35ccab | ||
|
|
5fc6eacc53 | ||
|
|
bd782362e8 | ||
|
|
32151a176f | ||
|
|
f7c88d2086 | ||
|
|
1eb76f2b90 | ||
|
|
226b3e049d | ||
|
|
7f0e9851cd | ||
|
|
15df77940e | ||
|
|
9781516552 | ||
|
|
a23264a542 | ||
|
|
0e7845985a | ||
|
|
93efe45347 | ||
|
|
a46f824e1e | ||
|
|
0de9f036bc | ||
|
|
275f2515d6 | ||
|
|
b4604928ec | ||
|
|
5a79b4021a | ||
|
|
280fd38039 | ||
|
|
b032364616 | ||
|
|
a430aaee97 | ||
|
|
f4ee2ca3b9 | ||
|
|
92b9212b31 | ||
|
|
73656e60ff | ||
|
|
401329d80c | ||
|
|
6131970724 | ||
|
|
85dcc4b78a | ||
|
|
34a1bf7e28 | ||
|
|
afdccefa98 | ||
|
|
e1fd0a5535 | ||
|
|
15d2cd7342 | ||
|
|
f5fda8b71f | ||
|
|
8586dbbe8b | ||
|
|
c508c71f60 | ||
|
|
33cabc8e2d | ||
|
|
e244d477e2 | ||
|
|
c2f81e182a | ||
|
|
d7c68cfaa9 | ||
|
|
b1aa5b8183 | ||
|
|
877b1dacf8 | ||
|
|
8eef664e50 | ||
|
|
f0581f5038 | ||
|
|
0b584d48b8 | ||
|
|
9199875c51 | ||
|
|
e062cc4870 | ||
|
|
2ba4d87b75 | ||
|
|
4b4c0df77d | ||
|
|
b5e4f32fa5 | ||
|
|
27ca45b088 | ||
|
|
345e38a560 | ||
|
|
176e4c8b3e | ||
|
|
81083dd30c | ||
|
|
9a5a09438e | ||
|
|
f17447b2f1 | ||
|
|
930eb14a8a | ||
|
|
08951f8c2e | ||
|
|
c74bb01c3c | ||
|
|
34b9b189d4 | ||
|
|
960aca266e | ||
|
|
840e04dc55 | ||
|
|
defaf3f970 | ||
|
|
b8b2349b6c | ||
|
|
c3c4671f76 | ||
|
|
d9811d9d50 | ||
|
|
da515f8595 | ||
|
|
467a8af504 | ||
|
|
ed16571d44 | ||
|
|
6d06f1fbce | ||
|
|
9a59b2ad3f | ||
|
|
1dc03ca5ae | ||
|
|
260de6eae5 | ||
|
|
2458377010 | ||
|
|
d4a7f2bbc8 | ||
|
|
1b8b009b58 | ||
|
|
a6623058b5 | ||
|
|
aa385a5e30 | ||
|
|
67e9113b48 | ||
|
|
9667279bf6 | ||
|
|
84e94c1122 | ||
|
|
12fd04b296 | ||
|
|
2e5ab39fee | ||
|
|
b975fedfee | ||
|
|
0670bca67d | ||
|
|
9a976fdd3c | ||
|
|
91d189cf00 | ||
|
|
b97e0df6c5 | ||
|
|
e966df976f | ||
|
|
530347c847 | ||
|
|
fc5acaf0be | ||
|
|
affea597bf | ||
|
|
732ad976bf | ||
|
|
b0133162f0 | ||
|
|
0fa462c385 | ||
|
|
f7d7ee6b43 | ||
|
|
b769b79b9a | ||
|
|
320001b3a3 | ||
|
|
5c53bb3853 | ||
|
|
584ac773b3 | ||
|
|
be6e034153 | ||
|
|
b85bb698d0 | ||
|
|
ecab1a45b9 | ||
|
|
d3a7f7a732 | ||
|
|
30b106c5c2 | ||
|
|
5b8148b83d | ||
|
|
a973696501 | ||
|
|
5bb5ad7ba8 | ||
|
|
72188223ae | ||
|
|
4fbd037af1 | ||
|
|
9789ab6e37 | ||
|
|
f766039139 | ||
|
|
9aad09be9a | ||
|
|
ea07a3e3ce | ||
|
|
4e9ea630d7 | ||
|
|
c4aeecdf3a | ||
|
|
ab36c69729 | ||
|
|
ade7d1f735 | ||
|
|
5c7d62c59b | ||
|
|
772de4e67b | ||
|
|
2505f3904d | ||
|
|
ea06ede236 | ||
|
|
d9132fad5a | ||
|
|
b20148b93f | ||
|
|
41dde8a164 | ||
|
|
c83c4b052b | ||
|
|
3dad8258df | ||
|
|
60f358510c | ||
|
|
46e5e5fbdc | ||
|
|
6561a63956 | ||
|
|
9a390616ad | ||
|
|
815ede7e1a | ||
|
|
4960657be7 | ||
|
|
0b18aa4906 | ||
|
|
f040827bc8 | ||
|
|
876c3b2ecd | ||
|
|
52c30a1e0e | ||
|
|
f2d93564a5 | ||
|
|
f19213d6f7 | ||
|
|
0e378ea982 | ||
|
|
51d8d48218 | ||
|
|
0f560a3594 | ||
|
|
07ea3e39b9 | ||
|
|
50851ad62a | ||
|
|
d45a956520 | ||
|
|
7e9e95b7d2 | ||
|
|
c02255dd08 | ||
|
|
c465e15e96 | ||
|
|
1da99434b3 | ||
|
|
368db8d94c | ||
|
|
a05c8cc3ea | ||
|
|
7d7ef2788e | ||
|
|
93844b0e20 | ||
|
|
45b8e7cc28 | ||
|
|
59aea26e72 | ||
|
|
a3a3a737ed | ||
|
|
69c048cfa6 | ||
|
|
045543f27a | ||
|
|
3369821875 | ||
|
|
e880edd680 | ||
|
|
c5d516949d | ||
|
|
cd695e5024 | ||
|
|
f97dd9747f | ||
|
|
67ed60731b | ||
|
|
d2c756a08a | ||
|
|
976d8a16e4 | ||
|
|
55f7a181cd | ||
|
|
55d0ebad03 | ||
|
|
5db9a064ca | ||
|
|
2a5fe72a34 | ||
|
|
fd6d36b6d9 | ||
|
|
2aafc85fae | ||
|
|
3905f4ed28 | ||
|
|
c6570ac499 | ||
|
|
9241be1f5f | ||
|
|
4fbd695f4e | ||
|
|
05b72a0c7e | ||
|
|
09ab982a4a | ||
|
|
70b2f20ca8 | ||
|
|
4f12a096e7 | ||
|
|
ea5df706a8 | ||
|
|
d92dae066d | ||
|
|
40345f6cb9 | ||
|
|
8aaf0eb99e | ||
|
|
cd1885477d | ||
|
|
28bb578170 | ||
|
|
2965df19cb | ||
|
|
36929f3ab4 | ||
|
|
e1f7ea8f18 | ||
|
|
7e4b603582 | ||
|
|
f82eaee49e | ||
|
|
e1fe3d959a | ||
|
|
86d3dd2c88 | ||
|
|
127e3ae325 | ||
|
|
16c8c3c873 | ||
|
|
58fbd9c581 | ||
|
|
91f75c60c6 | ||
|
|
dee60a5a34 | ||
|
|
013d53c346 | ||
|
|
d42e28f713 | ||
|
|
dc69407d76 | ||
|
|
ab228bb8d4 | ||
|
|
772ba40108 | ||
|
|
f143e2ea49 | ||
|
|
dd32fc58eb | ||
|
|
30f499f3cd | ||
|
|
c7325645be | ||
|
|
dfca75f19a | ||
|
|
70005b3b82 | ||
|
|
e51e2dfe27 | ||
|
|
57ddcb47f2 | ||
|
|
0ec2764369 | ||
|
|
2215a7895e | ||
|
|
bac86bd8e0 | ||
|
|
3f9540a415 | ||
|
|
e5be78e832 | ||
|
|
8a03d1c704 | ||
|
|
1655fd33eb | ||
|
|
af93e5d00e | ||
|
|
f2f1f1c879 | ||
|
|
fd7179c3f5 | ||
|
|
bbf4200b42 | ||
|
|
e50877ba5d | ||
|
|
61cf4eb964 | ||
|
|
87ca7fdc8d | ||
|
|
7745bbe60c | ||
|
|
949ebf83e3 | ||
|
|
6744282bf1 | ||
|
|
5b374b0410 | ||
|
|
efaa97b9bd | ||
|
|
87c5dd5fa7 | ||
|
|
023a5b75b4 | ||
|
|
7e6a5de0f1 | ||
|
|
348500a288 | ||
|
|
27be26d12d | ||
|
|
4932eab08a | ||
|
|
341e2ed7ff | ||
|
|
7af6dac964 | ||
|
|
f94d23723c | ||
|
|
170005fb79 | ||
|
|
5ebe3fd95c | ||
|
|
d49d2247c9 | ||
|
|
593c90f605 | ||
|
|
fa41140aed | ||
|
|
e246509ebf | ||
|
|
81db94ac8a | ||
|
|
de29c766b3 | ||
|
|
3e96586c8e | ||
|
|
7eac6cadb0 | ||
|
|
414ba32541 | ||
|
|
8d4db5b574 | ||
|
|
422b904e00 | ||
|
|
5ce627ee0b | ||
|
|
3ddb6f9abc | ||
|
|
583f2a17b5 | ||
|
|
e628f1f6d5 | ||
|
|
89f21867a5 | ||
|
|
4dd557feee | ||
|
|
cc315db34b | ||
|
|
086692e668 | ||
|
|
e7528205f6 | ||
|
|
af735e196e | ||
|
|
7dd59c3346 | ||
|
|
1c6ade5b77 | ||
|
|
f714da7662 | ||
|
|
907ae1db04 | ||
|
|
691dd4a7bd | ||
|
|
b1f531446a | ||
|
|
c5aeaf1452 | ||
|
|
c27914c957 | ||
|
|
6424e1e416 | ||
|
|
0fc0e12c08 | ||
|
|
dfc3e79709 | ||
|
|
f0b515ff5c | ||
|
|
2f39e3277f | ||
|
|
6576794456 | ||
|
|
bdc8223c6c | ||
|
|
d68cf3b557 | ||
|
|
11787d290b | ||
|
|
047a14dcbc | ||
|
|
f9d441a97f | ||
|
|
9cee124afd | ||
|
|
43cf348b72 | ||
|
|
86eb344492 | ||
|
|
9030628090 | ||
|
|
f6d39c7be3 | ||
|
|
a9931b114e | ||
|
|
87d9ce4486 | ||
|
|
b61256221a | ||
|
|
e9f43cb6f4 | ||
|
|
be79a9b4f9 | ||
|
|
a3ff2fbefe | ||
|
|
8d032cd867 | ||
|
|
71392cd54f | ||
|
|
92f14b1c12 | ||
|
|
7e9674c7a7 | ||
|
|
ccf0b070b0 | ||
|
|
a9536cccd1 | ||
|
|
5f26bdcefb | ||
|
|
015c901047 | ||
|
|
201ac15aea | ||
|
|
04725db699 | ||
|
|
9b72c785b5 | ||
|
|
ca20d585da | ||
|
|
48bcb80dd7 | ||
|
|
e4bf1f0d53 | ||
|
|
769764ad17 | ||
|
|
cbf732d072 | ||
|
|
9a60ded31c | ||
|
|
f7fa4a6dc5 | ||
|
|
d2f653decb | ||
|
|
7471265010 | ||
|
|
60e5dc0e57 | ||
|
|
9aacf8ca41 | ||
|
|
b91b4cd5b2 | ||
|
|
e5843a4f40 | ||
|
|
97259b5a14 | ||
|
|
e0e56faa5d | ||
|
|
f837fb31fc | ||
|
|
d1eef0a8c5 | ||
|
|
4a657451ed | ||
|
|
68a5af4bef | ||
|
|
d0018d4de8 | ||
|
|
38dd92754a | ||
|
|
1f2d68ffd2 | ||
|
|
f18d0c998f | ||
|
|
374e2e6b91 | ||
|
|
b2e439c94e | ||
|
|
875d616cbf | ||
|
|
837e229d11 | ||
|
|
8fd038cd11 | ||
|
|
ca8b44dd8d | ||
|
|
e8f767a56b | ||
|
|
b531c48083 | ||
|
|
bbab1c13a2 | ||
|
|
4334b48ab1 | ||
|
|
ab1ca7af80 | ||
|
|
ac54b65c87 | ||
|
|
35db1ff6b2 | ||
|
|
126bdcca73 | ||
|
|
5cfcb71759 | ||
|
|
e6a54b08f1 | ||
|
|
434ac7b577 | ||
|
|
7e3b3fae1c | ||
|
|
4c52629ba7 | ||
|
|
135b9b6e09 | ||
|
|
1647065b04 | ||
|
|
bf6b39707a | ||
|
|
4a4450260f | ||
|
|
4701234c94 | ||
|
|
8c4c4a25cb | ||
|
|
7be14d2d8c | ||
|
|
d8b387fbad | ||
|
|
6087377e8e | ||
|
|
e5797ef6a8 | ||
|
|
6817cafbfa | ||
|
|
bcdfeb03a8 | ||
|
|
8854328697 | ||
|
|
0d83b2a59f | ||
|
|
691b4b5e59 | ||
|
|
c4bffbda11 | ||
|
|
ef7da60ec0 | ||
|
|
95275c1b39 | ||
|
|
944714e4ba | ||
|
|
aa7962c959 | ||
|
|
97c13d5f44 | ||
|
|
004faffc4c | ||
|
|
eeef2abaf3 | ||
|
|
3a70c388cc | ||
|
|
b81044106e | ||
|
|
a5230d1da4 | ||
|
|
c1223aaee4 | ||
|
|
7175315abc | ||
|
|
00f4a722e1 | ||
|
|
664d847a71 | ||
|
|
21dedb7748 | ||
|
|
88a0c5dc57 | ||
|
|
4677c39b97 | ||
|
|
00b145d673 | ||
|
|
f04fff354a | ||
|
|
ca4264b838 | ||
|
|
0e4047c36f | ||
|
|
1f3bb11a5d | ||
|
|
f7a103ff89 | ||
|
|
555c326b0c | ||
|
|
4f74a770af | ||
|
|
b26b14a0f2 | ||
|
|
7d0e8c96ee | ||
|
|
a14439f128 | ||
|
|
4de8aba54a | ||
|
|
3814dda46e | ||
|
|
923716dd08 | ||
|
|
fa0f86c8a0 | ||
|
|
efb8d29f78 | ||
|
|
22c71009df | ||
|
|
4e48bae0ad | ||
|
|
ce55c5c011 | ||
|
|
7daf02e94c | ||
|
|
e4fdf60b8a | ||
|
|
b9ae73d865 | ||
|
|
e9583db6a7 | ||
|
|
89eda3c702 | ||
|
|
245e0e038b | ||
|
|
010579aa1b | ||
|
|
24e8337b41 | ||
|
|
d5f6224236 | ||
|
|
9ec8fe921d | ||
|
|
6fd1d294e5 | ||
|
|
d48c7271c0 | ||
|
|
d155c675f2 | ||
|
|
3a56faf123 | ||
|
|
bc74608271 | ||
|
|
484a615981 | ||
|
|
efe92ba356 | ||
|
|
25f4a815fd | ||
|
|
74f774bc3b | ||
|
|
e871beda8e | ||
|
|
ddc3011dd9 | ||
|
|
9bf9322994 | ||
|
|
325d1567a7 | ||
|
|
e3ed7fde45 | ||
|
|
e8810cc2a7 | ||
|
|
bf101519d8 | ||
|
|
58e1302b75 | ||
|
|
750a070fbb | ||
|
|
e8b3131d2e | ||
|
|
c00cc887e4 | ||
|
|
6fb8a5bbe5 | ||
|
|
952fcc2a1e | ||
|
|
d070592491 | ||
|
|
4fe64ddcb1 | ||
|
|
a10f10aa61 | ||
|
|
db2ad358cf | ||
|
|
124b19525f | ||
|
|
a64b9e1ab2 | ||
|
|
a936daf95b | ||
|
|
dba64f9ea7 | ||
|
|
2e6555a8cb | ||
|
|
52003c2d58 | ||
|
|
da028d6665 | ||
|
|
01a7746ae9 | ||
|
|
827fe3578f | ||
|
|
d4cf1d9aca | ||
|
|
c2a4be71c4 | ||
|
|
404fd0dfdd | ||
|
|
9ffd7c91b7 | ||
|
|
fc20046aaf | ||
|
|
934ccba81f | ||
|
|
4db502e0f1 | ||
|
|
dd9dbd8321 | ||
|
|
47102edfef | ||
|
|
9b86a6ee33 | ||
|
|
9cb4dbc79d | ||
|
|
4789e40574 | ||
|
|
39109ae40b | ||
|
|
b6ffe579e0 | ||
|
|
d2b94a9a0e | ||
|
|
809022b388 | ||
|
|
5c2c614a65 | ||
|
|
a0934d9aaf | ||
|
|
19ac2d9a0a | ||
|
|
ae5870556a | ||
|
|
87c42c810e | ||
|
|
d7d36b44b2 | ||
|
|
9bb44d3ae5 | ||
|
|
f216c03a7b | ||
|
|
d091fc48f6 | ||
|
|
0eeae3a7ff | ||
|
|
22c26c97f7 | ||
|
|
86c6416090 | ||
|
|
123c07efe0 | ||
|
|
d64f01bc54 | ||
|
|
415d7988b9 | ||
|
|
f846a1ac83 | ||
|
|
e95269d539 | ||
|
|
4161a3afc1 | ||
|
|
f842ed7b3d | ||
|
|
66c8bb7c78 | ||
|
|
cd499edd6c | ||
|
|
51d4e187b6 | ||
|
|
a75f648b71 | ||
|
|
66a253b4e9 | ||
|
|
076f8e0365 | ||
|
|
37c850cf6c | ||
|
|
dc93213811 | ||
|
|
56d8c6c236 | ||
|
|
0a0b114baf | ||
|
|
7c444b3c53 | ||
|
|
f4c72266ea | ||
|
|
f45e6c885e | ||
|
|
c4646a7de6 | ||
|
|
37be254f25 | ||
|
|
21d6244c3c | ||
|
|
d141e67f52 | ||
|
|
d2c4a79791 | ||
|
|
240058005f | ||
|
|
6d31f3791b | ||
|
|
7fba05d0d5 | ||
|
|
44ead9f469 | ||
|
|
7ef3971fe1 | ||
|
|
216a3d5d60 | ||
|
|
ffb6844a41 | ||
|
|
575723b860 | ||
|
|
50a000f1c7 | ||
|
|
476c73fed3 | ||
|
|
471e655eb3 | ||
|
|
934a436065 | ||
|
|
ba1508a82a | ||
|
|
0f67d14153 | ||
|
|
832d8f44f1 | ||
|
|
33343e1b1c | ||
|
|
28694cd2b7 | ||
|
|
c65f66decc | ||
|
|
73a4743e88 | ||
|
|
2bcbf6365e | ||
|
|
43301108ba | ||
|
|
7898d26461 | ||
|
|
13b3158bd6 | ||
|
|
f4f327f25d | ||
|
|
45ff09dadb | ||
|
|
bec78bc44c | ||
|
|
16e35935f9 | ||
|
|
d6603488b6 | ||
|
|
717c2d2ece | ||
|
|
e704af5494 | ||
|
|
5399d26c94 | ||
|
|
a32e29a378 | ||
|
|
a62c474f99 | ||
|
|
c507bb0238 | ||
|
|
30902eeac8 | ||
|
|
9442d58f4c | ||
|
|
55a14cfedc | ||
|
|
3d0ea980c8 | ||
|
|
c9f7696519 | ||
|
|
623d435758 | ||
|
|
05f06f09d4 | ||
|
|
e19402c80c | ||
|
|
cb87c5ba71 | ||
|
|
657eca08bf | ||
|
|
4c58c86f84 | ||
|
|
9b73a057fa | ||
|
|
3c9bf95728 | ||
|
|
2f48af5afe | ||
|
|
f7f5ba15ff | ||
|
|
5fd014f023 | ||
|
|
caf3f4a783 | ||
|
|
b264bf6f58 | ||
|
|
06b07cf9a0 | ||
|
|
e5804b22cd | ||
|
|
85f292e1d2 | ||
|
|
057f05a88a | ||
|
|
a700267ee6 | ||
|
|
331e33ec70 | ||
|
|
c9dc118af6 | ||
|
|
e1e24a3350 | ||
|
|
339dfd1c0b | ||
|
|
5bcc81c00a | ||
|
|
e7212ed506 | ||
|
|
c705c282d1 | ||
|
|
20ea1f8209 | ||
|
|
fa73171d7d | ||
|
|
a27675a783 | ||
|
|
2ddae1f0b9 | ||
|
|
415acc7780 | ||
|
|
7590cf824f | ||
|
|
3ee88ddfb4 | ||
|
|
4d5f90e0ec | ||
|
|
694a65e9de | ||
|
|
7e33103758 | ||
|
|
e04f26223e | ||
|
|
cd76b72d3c | ||
|
|
57372fe922 | ||
|
|
82ca7fdcdc | ||
|
|
c6d9fb89ba | ||
|
|
2ecd88586b | ||
|
|
d8779bed14 | ||
|
|
7ad988bceb | ||
|
|
04fc897a60 | ||
|
|
7922ba15ce | ||
|
|
fae27f7e19 | ||
|
|
7ba2f29efc | ||
|
|
0e8439d52b | ||
|
|
17c60b6b4e | ||
|
|
4ec54b2dbc | ||
|
|
409b1fa00d | ||
|
|
ad5fc52d66 | ||
|
|
4b4d21a0de | ||
|
|
3642a3fec5 | ||
|
|
cac097ea66 | ||
|
|
4a2b0d9d9f | ||
|
|
6e53e7a23b | ||
|
|
1e1e86dc16 | ||
|
|
e7777877fa | ||
|
|
3a685eb316 | ||
|
|
344509ec28 | ||
|
|
b70a2951bd | ||
|
|
63282f42b2 | ||
|
|
03786817ed | ||
|
|
680bffa9e8 | ||
|
|
6f07ec52ad | ||
|
|
daecb76f8e | ||
|
|
7f653d900d | ||
|
|
4cd3e682b9 | ||
|
|
143cceeade | ||
|
|
fb8ca67ac1 | ||
|
|
80fc1c4112 | ||
|
|
eecdeb0af4 | ||
|
|
5e9e11694d | ||
|
|
bb41f89d44 | ||
|
|
4158f25b35 | ||
|
|
3694cd0694 | ||
|
|
a5a06fbaab | ||
|
|
a5ee38d4fd | ||
|
|
eca95c36dd | ||
|
|
554b4047b9 | ||
|
|
b1e8b4eb11 | ||
|
|
b3f693556c | ||
|
|
e2fd50d152 | ||
|
|
f1cb9a824d | ||
|
|
da0e718276 | ||
|
|
4519a4175b | ||
|
|
4fa375f4f4 | ||
|
|
3ca5fdb082 | ||
|
|
32ae726050 | ||
|
|
83950cbecb | ||
|
|
5b9f63bc91 | ||
|
|
7b93072093 | ||
|
|
90c312ea5c | ||
|
|
2bec38d85f | ||
|
|
b8ab1780d3 | ||
|
|
997ad34151 | ||
|
|
e960d4f00b | ||
|
|
52fe9e2c13 | ||
|
|
e6b386dabf | ||
|
|
f558095a0e | ||
|
|
014a604c86 | ||
|
|
5e7f2f0d5a | ||
|
|
11b52cb212 | ||
|
|
aa7abab742 | ||
|
|
f5ce6e47e2 | ||
|
|
05258e6fce | ||
|
|
7675ead837 | ||
|
|
6e80a19933 | ||
|
|
3a6cf05647 | ||
|
|
147cd32129 | ||
|
|
9789117759 | ||
|
|
aeee5658d3 | ||
|
|
949ac2de98 | ||
|
|
5b4333dacf | ||
|
|
561cd7111e | ||
|
|
784ee84fb3 | ||
|
|
b0cf548775 | ||
|
|
55c315eb98 | ||
|
|
9bcb41ab5d | ||
|
|
007b1bd21b | ||
|
|
9dae7988fd | ||
|
|
8877d7ea55 | ||
|
|
f35a23a53d | ||
|
|
64484ef18b | ||
|
|
0d9381b528 | ||
|
|
d57465d067 | ||
|
|
5039dac045 | ||
|
|
6073357bb6 | ||
|
|
a00343d444 | ||
|
|
a0b4681369 | ||
|
|
ea340f3fc2 | ||
|
|
db39483f97 | ||
|
|
e575511849 | ||
|
|
9dc3030c18 | ||
|
|
f990d7584e | ||
|
|
133d560e64 | ||
|
|
b3ba764d89 | ||
|
|
3ff1124c30 | ||
|
|
da927c8f7b | ||
|
|
cb211d8ba1 | ||
|
|
9cbebbdd6a | ||
|
|
8684e21da3 | ||
|
|
3f9a90f758 | ||
|
|
661a58b549 | ||
|
|
a47b049dfd | ||
|
|
58b2918ea4 | ||
|
|
484b4cb280 | ||
|
|
a77d512bac | ||
|
|
e295354aa1 | ||
|
|
7aeae1e998 | ||
|
|
9b98afd6cf | ||
|
|
bad97971db | ||
|
|
6f8c122503 | ||
|
|
8b25aecb3a | ||
|
|
400846cab4 | ||
|
|
72708bdef0 | ||
|
|
23d817d1f3 | ||
|
|
daf4086bc9 | ||
|
|
ab2e9ca43e | ||
|
|
222d69218a | ||
|
|
ae03da927e | ||
|
|
9cb311a6c9 | ||
|
|
dfd665088e | ||
|
|
51afd70fff | ||
|
|
203abc1ff9 | ||
|
|
a0487671d2 | ||
|
|
88e605fc5a | ||
|
|
130c390916 | ||
|
|
93389633ba | ||
|
|
53897cf779 | ||
|
|
9192ac2c81 | ||
|
|
d54b8ab756 | ||
|
|
67210ce23b | ||
|
|
a89f27abb9 | ||
|
|
37eccd8a58 | ||
|
|
452fd810ac | ||
|
|
cd91a79578 | ||
|
|
4c70fb9cfa | ||
|
|
62dcd672fe | ||
|
|
fde40577ee | ||
|
|
963633328c | ||
|
|
bddf214f91 | ||
|
|
c7ef2eeec7 | ||
|
|
8b988a3f02 | ||
|
|
792337ed73 | ||
|
|
d1e5f9d0a4 | ||
|
|
d202746829 | ||
|
|
72724c6014 | ||
|
|
8cdbe8a491 | ||
|
|
4617161f3d | ||
|
|
ffed4f56bf | ||
|
|
19f9390020 | ||
|
|
10a4401259 | ||
|
|
ed7ab76cd6 | ||
|
|
ccfe1bac74 | ||
|
|
0c2071bc5d | ||
|
|
2d503ab05a | ||
|
|
0f204b48dd | ||
|
|
ac586267c5 | ||
|
|
897619f126 | ||
|
|
5fef08797d | ||
|
|
b43c3a7294 | ||
|
|
423b145b7f | ||
|
|
93333a4915 | ||
|
|
b3708abcb6 | ||
|
|
f8c2580773 | ||
|
|
4609d5588d | ||
|
|
cbeb44779f | ||
|
|
7c848aa372 | ||
|
|
015fca8145 | ||
|
|
54cc5fbad5 | ||
|
|
66f66dd408 | ||
|
|
24de9d5988 | ||
|
|
7dc5fdc88e |
@@ -195,3 +195,4 @@ plugins/goedge-happy
|
||||
/plugins/tools
|
||||
/plugins/choose-linux-python
|
||||
*.md5
|
||||
/bak
|
||||
|
||||
@@ -36,7 +36,7 @@ Talk is cheap, show me the code. -- linus
|
||||
```
|
||||
|
||||
- [兼容性测试报告](/compatibility.md)
|
||||
- [常用命令说明](/cmd.md) [ mw default ] [ mw update_dev ]
|
||||
- [常用命令说明](/cmd.md) [ mw default ] [ mw dev ]
|
||||
|
||||
### 特别赞助
|
||||
|
||||
@@ -108,10 +108,9 @@ docker run -itd --name mw-server --privileged=true -p 7200:7200 -p 80:80 -p 443:
|
||||
```
|
||||
|
||||
|
||||
### 版本更新 0.18.2
|
||||
### 版本更新 0.18.5
|
||||
|
||||
- 备份目录功能支持排除目录。
|
||||
- 其他细节优化。
|
||||
- 常规优化。
|
||||
|
||||
### JSDelivr安装地址
|
||||
|
||||
|
||||
@@ -60,7 +60,7 @@ mw_start_debug(){
|
||||
if [ -f ${DIR}/data/port.pl ];then
|
||||
port=$(cat ${DIR}/data/port.pl)
|
||||
fi
|
||||
cd ${DIR}/web && gunicorn -b :${port} -k eventlet -w 1 app:app
|
||||
cd ${DIR}/web && gunicorn -b :${port} -k gthread -w 1 app:app
|
||||
# cd ${DIR}/web && gunicorn -b :${port} -k geventwebsocket.gunicorn.workers.GeventWebSocketWorker -w 1 app:app
|
||||
}
|
||||
|
||||
@@ -69,7 +69,7 @@ mw_start_panel(){
|
||||
if [ -f ${DIR}/data/port.pl ];then
|
||||
port=$(cat ${DIR}/data/port.pl)
|
||||
fi
|
||||
cd ${DIR}/web && gunicorn -b :${port} -k eventlet -w 1 app:app
|
||||
cd ${DIR}/web && gunicorn -b :${port} -k gthread -w 1 app:app
|
||||
# cd ${DIR}/web && gunicorn -b :${port} -k geventwebsocket.gunicorn.workers.GeventWebSocketWorker -w 1 app:app
|
||||
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ mw redis | 快捷连接Redis
|
||||
mw valkey | 快捷连接valkey
|
||||
mw mongodb | 快捷连接MongoDB
|
||||
mw pgdb | 快捷连接PostgreSQL
|
||||
mw ssh | 快捷连接ssh
|
||||
----------------------------------------
|
||||
mw open | 开启面板
|
||||
mw close | 关闭面板
|
||||
|
||||
+1
-1
@@ -183,7 +183,7 @@ def check502():
|
||||
verlist = [
|
||||
'52', '53', '54', '55', '56', '70',
|
||||
'71', '72', '73', '74', '80', '81',
|
||||
'82', '83', '84'
|
||||
'82', '83', '84', '85'
|
||||
]
|
||||
for ver in verlist:
|
||||
server_dir = mw.getServerDir()
|
||||
|
||||
+43
-1
@@ -80,6 +80,7 @@ def mwcli(mw_input=0):
|
||||
'(101) 关闭PHP52显示',
|
||||
'(200) 切换Linux系统软件源',
|
||||
'(201) 简单速度测试',
|
||||
'(202) SSH终端管理',
|
||||
'(0) 取消'
|
||||
]
|
||||
cmd_list_num = len(cmd_list)
|
||||
@@ -105,7 +106,7 @@ def mwcli(mw_input=0):
|
||||
10, 11, 12, 13, 14, 15,
|
||||
20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
|
||||
100, 101,
|
||||
200, 201
|
||||
200, 201, 202
|
||||
]
|
||||
if not mw_input in nums:
|
||||
print(raw_tip)
|
||||
@@ -264,7 +265,48 @@ def mwcli(mw_input=0):
|
||||
# os.system(INIT_CMD + " mirror")
|
||||
elif mw_input == 201:
|
||||
os.system('curl -Lso- bench.sh | bash')
|
||||
elif mw_input == 202:
|
||||
package = mw.getPanelDir()+'/plugins'
|
||||
|
||||
dst_plugin = mw.getServerDir() + "/webssh"
|
||||
if not os.path.exists(dst_plugin):
|
||||
mw.echoInfo("未安装!")
|
||||
exit(1)
|
||||
|
||||
if not package in sys.path:
|
||||
sys.path.append(package)
|
||||
from webssh.index import App
|
||||
|
||||
obj = App()
|
||||
data = obj.get_server_list()
|
||||
data = json.loads(data)
|
||||
|
||||
if data['status']:
|
||||
wlist = data['data']
|
||||
wlist_len = len(wlist)
|
||||
if wlist_len == 0:
|
||||
mw.echoInfo("SSH终端管理,数据为空!")
|
||||
exit(1)
|
||||
|
||||
if len(sys.argv) == 4:
|
||||
pos = int(sys.argv[3])
|
||||
if pos >= wlist_len:
|
||||
mw.echoInfo("SSH终端管理,超过限制!")
|
||||
exit(1)
|
||||
dst_data = wlist[pos]
|
||||
tmp_host = dst_data["host"]
|
||||
info = obj.get_server_by_host_data(tmp_host)
|
||||
pp_info = tmp_host+"|"+info["port"]+"|"+info['username']+"|"+info['password']+""
|
||||
print(pp_info)
|
||||
exit(0)
|
||||
|
||||
mw.echoInfo("请选择:")
|
||||
for x in range(wlist_len):
|
||||
dst_data = wlist[x]
|
||||
tag = dst_data['host']
|
||||
if dst_data['ps'] != "":
|
||||
tag = dst_data['ps']
|
||||
print(str(x) +") " + tag)
|
||||
|
||||
def open_ssh_port():
|
||||
|
||||
|
||||
@@ -122,7 +122,7 @@ def openPort():
|
||||
return True
|
||||
|
||||
def status():
|
||||
cmd = "ps aux|grep alist |grep -v grep | grep -v python | grep -v mdserver-web | awk '{print $2}'"
|
||||
cmd = "ps -ef|grep alist |grep -v grep | grep -v python | grep -v mdserver-web | awk '{print $2}'"
|
||||
data = mw.execShell(cmd)
|
||||
if data[0] == '':
|
||||
return 'stop'
|
||||
|
||||
Executable
+35
@@ -0,0 +1,35 @@
|
||||
#!/bin/bash
|
||||
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin:/opt/homebrew/bin
|
||||
export PATH
|
||||
|
||||
# OpenResty服务名称
|
||||
service_name="openresty"
|
||||
|
||||
# 检查OpenResty是否正在运行
|
||||
if systemctl is-active --quiet "$service_name"; then
|
||||
# 检查是否存在僵尸进程
|
||||
zombie_processes=$(ps -ef | grep -i openresty | grep -v grep | awk '{print $2}' | xargs ps -o state= -p 2>/dev/null | grep -c Z)
|
||||
if [ "$zombie_processes" -gt 0 ]; then
|
||||
echo "kill nginx 僵尸进程"
|
||||
ps -ef|grep nginx| grep -v grep| awk '{print $2}' | xargs kill -9
|
||||
echo "检测到OpenResty僵尸进程,正在重启服务..."
|
||||
systemctl restart "$service_name"
|
||||
echo "服务已重启"
|
||||
else
|
||||
echo "OpenResty运行正常"
|
||||
fi
|
||||
else
|
||||
echo "kill nginx"
|
||||
ps -ef|grep nginx| grep -v grep| awk '{print $2}' | xargs kill -9
|
||||
echo "OpenResty未运行,正在启动服务..."
|
||||
systemctl start "$service_name"
|
||||
echo "服务已启动"
|
||||
fi
|
||||
|
||||
NGINX_IDS=`ps -ef|grep nginx | grep -v grep| awk '{print $2}'`
|
||||
if [ "$NGINX_IDS" == "" ];then
|
||||
ps -ef|grep nginx| grep -v grep| awk '{print $2}' | xargs kill -9
|
||||
systemctl start "$service_name"
|
||||
echo "OpenResty未运行,正在启动服务..."
|
||||
fi
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
<IfModule !mpm_netware_module>
|
||||
PidFile "logs/httpd.pid"
|
||||
</IfModule>
|
||||
|
||||
<IfModule mpm_prefork_module>
|
||||
StartServers 5
|
||||
MinSpareServers 5
|
||||
MaxSpareServers 10
|
||||
MaxRequestWorkers 250
|
||||
MaxConnectionsPerChild 0
|
||||
</IfModule>
|
||||
|
||||
<IfModule mpm_worker_module>
|
||||
StartServers 3
|
||||
MinSpareThreads 75
|
||||
MaxSpareThreads 250
|
||||
ThreadsPerChild 25
|
||||
MaxRequestWorkers 400
|
||||
MaxConnectionsPerChild 0
|
||||
</IfModule>
|
||||
|
||||
<IfModule mpm_event_module>
|
||||
StartServers 3
|
||||
MinSpareThreads 75
|
||||
MaxSpareThreads 250
|
||||
ThreadsPerChild 25
|
||||
MaxRequestWorkers 400
|
||||
MaxConnectionsPerChild 0
|
||||
</IfModule>
|
||||
|
||||
<IfModule mpm_netware_module>
|
||||
ThreadStackSize 65536
|
||||
StartThreads 250
|
||||
MinSpareThreads 25
|
||||
MaxSpareThreads 250
|
||||
MaxThreads 1000
|
||||
MaxConnectionsPerChild 0
|
||||
</IfModule>
|
||||
|
||||
<IfModule mpm_mpmt_os2_module>
|
||||
StartServers 2
|
||||
MinSpareThreads 5
|
||||
MaxSpareThreads 10
|
||||
MaxConnectionsPerChild 0
|
||||
</IfModule>
|
||||
|
||||
<IfModule mpm_winnt_module>
|
||||
ThreadsPerChild 150
|
||||
MaxConnectionsPerChild 0
|
||||
</IfModule>
|
||||
|
||||
<IfModule !mpm_netware_module>
|
||||
MaxMemFree 2048
|
||||
</IfModule>
|
||||
<IfModule mpm_netware_module>
|
||||
MaxMemFree 100
|
||||
</IfModule>
|
||||
@@ -0,0 +1,105 @@
|
||||
ServerRoot "{$SERVER_PATH}/apache/httpd"
|
||||
Listen 8280
|
||||
|
||||
LoadModule authn_file_module modules/mod_authn_file.so
|
||||
LoadModule authn_core_module modules/mod_authn_core.so
|
||||
LoadModule authz_host_module modules/mod_authz_host.so
|
||||
LoadModule authz_groupfile_module modules/mod_authz_groupfile.so
|
||||
LoadModule authz_user_module modules/mod_authz_user.so
|
||||
LoadModule authz_core_module modules/mod_authz_core.so
|
||||
LoadModule access_compat_module modules/mod_access_compat.so
|
||||
LoadModule auth_basic_module modules/mod_auth_basic.so
|
||||
LoadModule reqtimeout_module modules/mod_reqtimeout.so
|
||||
LoadModule filter_module modules/mod_filter.so
|
||||
LoadModule brotli_module modules/mod_brotli.so
|
||||
LoadModule mime_module modules/mod_mime.so
|
||||
LoadModule log_config_module modules/mod_log_config.so
|
||||
LoadModule env_module modules/mod_env.so
|
||||
LoadModule expires_module modules/mod_expires.so
|
||||
LoadModule headers_module modules/mod_headers.so
|
||||
LoadModule unique_id_module modules/mod_unique_id.so
|
||||
LoadModule setenvif_module modules/mod_setenvif.so
|
||||
LoadModule version_module modules/mod_version.so
|
||||
LoadModule unixd_module modules/mod_unixd.so
|
||||
LoadModule status_module modules/mod_status.so
|
||||
LoadModule dir_module modules/mod_dir.so
|
||||
LoadModule alias_module modules/mod_alias.so
|
||||
LoadModule rewrite_module modules/mod_rewrite.so
|
||||
|
||||
<IfModule unixd_module>
|
||||
User daemon
|
||||
Group daemon
|
||||
</IfModule>
|
||||
|
||||
ServerAdmin you@example.com
|
||||
ServerName localhost:8280
|
||||
|
||||
<Directory />
|
||||
AllowOverride none
|
||||
Require all denied
|
||||
</Directory>
|
||||
|
||||
DocumentRoot "{$SERVER_PATH}/apache/httpd/htdocs"
|
||||
<Directory "{$SERVER_PATH}/apache/httpd/htdocs">
|
||||
Options Indexes FollowSymLinks
|
||||
AllowOverride None
|
||||
Require all granted
|
||||
</Directory>
|
||||
|
||||
<IfModule dir_module>
|
||||
DirectoryIndex index.html
|
||||
</IfModule>
|
||||
|
||||
<Files ".ht*">
|
||||
Require all denied
|
||||
</Files>
|
||||
|
||||
ErrorLog "logs/error.log"
|
||||
LogLevel warn
|
||||
|
||||
<IfModule log_config_module>
|
||||
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
|
||||
LogFormat "%h %l %u %t \"%r\" %>s %b" common
|
||||
|
||||
<IfModule logio_module>
|
||||
# You need to enable mod_logio.c to use %I and %O
|
||||
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio
|
||||
</IfModule>
|
||||
|
||||
CustomLog "logs/access.log" common
|
||||
</IfModule>
|
||||
|
||||
<IfModule alias_module>
|
||||
ScriptAlias /cgi-bin/ "{$SERVER_PATH}/apache/httpd/cgi-bin/"
|
||||
</IfModule>
|
||||
|
||||
<IfModule cgid_module>
|
||||
</IfModule>
|
||||
|
||||
<Directory "{$SERVER_PATH}/apache/httpd/cgi-bin">
|
||||
AllowOverride None
|
||||
Options None
|
||||
Require all granted
|
||||
</Directory>
|
||||
|
||||
<IfModule headers_module>
|
||||
RequestHeader unset Proxy early
|
||||
</IfModule>
|
||||
|
||||
<IfModule mime_module>
|
||||
AddType application/x-compress .Z
|
||||
AddType application/x-gzip .gz .tgz
|
||||
</IfModule>
|
||||
|
||||
EnableSendfile on
|
||||
|
||||
Include conf/extra/httpd-info.conf
|
||||
Include conf/extra/httpd-mpm.conf
|
||||
|
||||
<IfModule ssl_module>
|
||||
SSLRandomSeed startup builtin
|
||||
SSLRandomSeed connect builtin
|
||||
</IfModule>
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,506 @@
|
||||
#
|
||||
# This is the main Apache HTTP server configuration file. It contains the
|
||||
# configuration directives that give the server its instructions.
|
||||
# See <URL:http://httpd.apache.org/docs/2.4/> for detailed information.
|
||||
# In particular, see
|
||||
# <URL:http://httpd.apache.org/docs/2.4/mod/directives.html>
|
||||
# for a discussion of each configuration directive.
|
||||
#
|
||||
# Do NOT simply read the instructions in here without understanding
|
||||
# what they do. They're here only as hints or reminders. If you are unsure
|
||||
# consult the online docs. You have been warned.
|
||||
#
|
||||
# Configuration and logfile names: If the filenames you specify for many
|
||||
# of the server's control files begin with "/" (or "drive:/" for Win32), the
|
||||
# server will use that explicit path. If the filenames do *not* begin
|
||||
# with "/", the value of ServerRoot is prepended -- so "logs/access_log"
|
||||
# with ServerRoot set to "/usr/local/apache2" will be interpreted by the
|
||||
# server as "/usr/local/apache2/logs/access_log", whereas "/logs/access_log"
|
||||
# will be interpreted as '/logs/access_log'.
|
||||
|
||||
#
|
||||
# ServerRoot: The top of the directory tree under which the server's
|
||||
# configuration, error, and log files are kept.
|
||||
#
|
||||
# Do not add a slash at the end of the directory path. If you point
|
||||
# ServerRoot at a non-local disk, be sure to specify a local disk on the
|
||||
# Mutex directive, if file-based mutexes are used. If you wish to share the
|
||||
# same ServerRoot for multiple httpd daemons, you will need to change at
|
||||
# least PidFile.
|
||||
#
|
||||
ServerRoot "/Users/midoks/Desktop/mwdev/server/apache/httpd"
|
||||
|
||||
#
|
||||
# Mutex: Allows you to set the mutex mechanism and mutex file directory
|
||||
# for individual mutexes, or change the global defaults
|
||||
#
|
||||
# Uncomment and change the directory if mutexes are file-based and the default
|
||||
# mutex file directory is not on a local disk or is not appropriate for some
|
||||
# other reason.
|
||||
#
|
||||
# Mutex default:logs
|
||||
|
||||
#
|
||||
# Listen: Allows you to bind Apache to specific IP addresses and/or
|
||||
# ports, instead of the default. See also the <VirtualHost>
|
||||
# directive.
|
||||
#
|
||||
# Change this to Listen on specific IP addresses as shown below to
|
||||
# prevent Apache from glomming onto all bound IP addresses.
|
||||
#
|
||||
#Listen 12.34.56.78:80
|
||||
Listen 80
|
||||
|
||||
#
|
||||
# Dynamic Shared Object (DSO) Support
|
||||
#
|
||||
# To be able to use the functionality of a module which was built as a DSO you
|
||||
# have to place corresponding `LoadModule' lines at this location so the
|
||||
# directives contained in it are actually available _before_ they are used.
|
||||
# Statically compiled modules (those listed by `httpd -l') do not need
|
||||
# to be loaded here.
|
||||
#
|
||||
# Example:
|
||||
# LoadModule foo_module modules/mod_foo.so
|
||||
#
|
||||
LoadModule authn_file_module modules/mod_authn_file.so
|
||||
#LoadModule authn_dbm_module modules/mod_authn_dbm.so
|
||||
#LoadModule authn_anon_module modules/mod_authn_anon.so
|
||||
#LoadModule authn_dbd_module modules/mod_authn_dbd.so
|
||||
#LoadModule authn_socache_module modules/mod_authn_socache.so
|
||||
LoadModule authn_core_module modules/mod_authn_core.so
|
||||
LoadModule authz_host_module modules/mod_authz_host.so
|
||||
LoadModule authz_groupfile_module modules/mod_authz_groupfile.so
|
||||
LoadModule authz_user_module modules/mod_authz_user.so
|
||||
#LoadModule authz_dbm_module modules/mod_authz_dbm.so
|
||||
#LoadModule authz_owner_module modules/mod_authz_owner.so
|
||||
#LoadModule authz_dbd_module modules/mod_authz_dbd.so
|
||||
LoadModule authz_core_module modules/mod_authz_core.so
|
||||
LoadModule access_compat_module modules/mod_access_compat.so
|
||||
LoadModule auth_basic_module modules/mod_auth_basic.so
|
||||
#LoadModule auth_form_module modules/mod_auth_form.so
|
||||
#LoadModule auth_digest_module modules/mod_auth_digest.so
|
||||
#LoadModule allowmethods_module modules/mod_allowmethods.so
|
||||
#LoadModule file_cache_module modules/mod_file_cache.so
|
||||
#LoadModule cache_module modules/mod_cache.so
|
||||
#LoadModule cache_disk_module modules/mod_cache_disk.so
|
||||
#LoadModule cache_socache_module modules/mod_cache_socache.so
|
||||
#LoadModule socache_shmcb_module modules/mod_socache_shmcb.so
|
||||
#LoadModule socache_dbm_module modules/mod_socache_dbm.so
|
||||
#LoadModule socache_memcache_module modules/mod_socache_memcache.so
|
||||
#LoadModule socache_redis_module modules/mod_socache_redis.so
|
||||
#LoadModule watchdog_module modules/mod_watchdog.so
|
||||
#LoadModule macro_module modules/mod_macro.so
|
||||
#LoadModule dbd_module modules/mod_dbd.so
|
||||
#LoadModule dumpio_module modules/mod_dumpio.so
|
||||
#LoadModule buffer_module modules/mod_buffer.so
|
||||
#LoadModule ratelimit_module modules/mod_ratelimit.so
|
||||
LoadModule reqtimeout_module modules/mod_reqtimeout.so
|
||||
#LoadModule ext_filter_module modules/mod_ext_filter.so
|
||||
#LoadModule request_module modules/mod_request.so
|
||||
#LoadModule include_module modules/mod_include.so
|
||||
LoadModule filter_module modules/mod_filter.so
|
||||
#LoadModule substitute_module modules/mod_substitute.so
|
||||
#LoadModule sed_module modules/mod_sed.so
|
||||
#LoadModule brotli_module modules/mod_brotli.so
|
||||
LoadModule mime_module modules/mod_mime.so
|
||||
LoadModule log_config_module modules/mod_log_config.so
|
||||
#LoadModule log_debug_module modules/mod_log_debug.so
|
||||
#LoadModule logio_module modules/mod_logio.so
|
||||
LoadModule env_module modules/mod_env.so
|
||||
#LoadModule expires_module modules/mod_expires.so
|
||||
LoadModule headers_module modules/mod_headers.so
|
||||
#LoadModule unique_id_module modules/mod_unique_id.so
|
||||
LoadModule setenvif_module modules/mod_setenvif.so
|
||||
LoadModule version_module modules/mod_version.so
|
||||
#LoadModule remoteip_module modules/mod_remoteip.so
|
||||
#LoadModule proxy_module modules/mod_proxy.so
|
||||
#LoadModule proxy_connect_module modules/mod_proxy_connect.so
|
||||
#LoadModule proxy_ftp_module modules/mod_proxy_ftp.so
|
||||
#LoadModule proxy_http_module modules/mod_proxy_http.so
|
||||
#LoadModule proxy_fcgi_module modules/mod_proxy_fcgi.so
|
||||
#LoadModule proxy_scgi_module modules/mod_proxy_scgi.so
|
||||
#LoadModule proxy_uwsgi_module modules/mod_proxy_uwsgi.so
|
||||
#LoadModule proxy_fdpass_module modules/mod_proxy_fdpass.so
|
||||
#LoadModule proxy_wstunnel_module modules/mod_proxy_wstunnel.so
|
||||
#LoadModule proxy_ajp_module modules/mod_proxy_ajp.so
|
||||
#LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
|
||||
#LoadModule proxy_express_module modules/mod_proxy_express.so
|
||||
#LoadModule proxy_hcheck_module modules/mod_proxy_hcheck.so
|
||||
#LoadModule session_module modules/mod_session.so
|
||||
#LoadModule session_cookie_module modules/mod_session_cookie.so
|
||||
#LoadModule session_dbd_module modules/mod_session_dbd.so
|
||||
#LoadModule slotmem_shm_module modules/mod_slotmem_shm.so
|
||||
#LoadModule ssl_module modules/mod_ssl.so
|
||||
#LoadModule http2_module modules/mod_http2.so
|
||||
#LoadModule lbmethod_byrequests_module modules/mod_lbmethod_byrequests.so
|
||||
#LoadModule lbmethod_bytraffic_module modules/mod_lbmethod_bytraffic.so
|
||||
#LoadModule lbmethod_bybusyness_module modules/mod_lbmethod_bybusyness.so
|
||||
#LoadModule lbmethod_heartbeat_module modules/mod_lbmethod_heartbeat.so
|
||||
LoadModule unixd_module modules/mod_unixd.so
|
||||
#LoadModule dav_module modules/mod_dav.so
|
||||
LoadModule status_module modules/mod_status.so
|
||||
LoadModule autoindex_module modules/mod_autoindex.so
|
||||
#LoadModule info_module modules/mod_info.so
|
||||
#LoadModule cgid_module modules/mod_cgid.so
|
||||
#LoadModule dav_fs_module modules/mod_dav_fs.so
|
||||
#LoadModule vhost_alias_module modules/mod_vhost_alias.so
|
||||
#LoadModule negotiation_module modules/mod_negotiation.so
|
||||
LoadModule dir_module modules/mod_dir.so
|
||||
#LoadModule actions_module modules/mod_actions.so
|
||||
#LoadModule speling_module modules/mod_speling.so
|
||||
#LoadModule userdir_module modules/mod_userdir.so
|
||||
LoadModule alias_module modules/mod_alias.so
|
||||
#LoadModule rewrite_module modules/mod_rewrite.so
|
||||
|
||||
<IfModule unixd_module>
|
||||
#
|
||||
# If you wish httpd to run as a different user or group, you must run
|
||||
# httpd as root initially and it will switch.
|
||||
#
|
||||
# User/Group: The name (or #number) of the user/group to run httpd as.
|
||||
# It is usually good practice to create a dedicated user and group for
|
||||
# running httpd, as with most system services.
|
||||
#
|
||||
User daemon
|
||||
Group daemon
|
||||
|
||||
</IfModule>
|
||||
|
||||
# 'Main' server configuration
|
||||
#
|
||||
# The directives in this section set up the values used by the 'main'
|
||||
# server, which responds to any requests that aren't handled by a
|
||||
# <VirtualHost> definition. These values also provide defaults for
|
||||
# any <VirtualHost> containers you may define later in the file.
|
||||
#
|
||||
# All of these directives may appear inside <VirtualHost> containers,
|
||||
# in which case these default settings will be overridden for the
|
||||
# virtual host being defined.
|
||||
#
|
||||
|
||||
#
|
||||
# ServerAdmin: Your address, where problems with the server should be
|
||||
# e-mailed. This address appears on some server-generated pages, such
|
||||
# as error documents. e.g. admin@your-domain.com
|
||||
#
|
||||
ServerAdmin you@example.com
|
||||
|
||||
#
|
||||
# ServerName gives the name and port that the server uses to identify itself.
|
||||
# This can often be determined automatically, but we recommend you specify
|
||||
# it explicitly to prevent problems during startup.
|
||||
#
|
||||
# If your host doesn't have a registered DNS name, enter its IP address here.
|
||||
#
|
||||
#ServerName www.example.com:80
|
||||
|
||||
#
|
||||
# Deny access to the entirety of your server's filesystem. You must
|
||||
# explicitly permit access to web content directories in other
|
||||
# <Directory> blocks below.
|
||||
#
|
||||
<Directory />
|
||||
AllowOverride none
|
||||
Require all denied
|
||||
</Directory>
|
||||
|
||||
#
|
||||
# Note that from this point forward you must specifically allow
|
||||
# particular features to be enabled - so if something's not working as
|
||||
# you might expect, make sure that you have specifically enabled it
|
||||
# below.
|
||||
#
|
||||
|
||||
#
|
||||
# DocumentRoot: The directory out of which you will serve your
|
||||
# documents. By default, all requests are taken from this directory, but
|
||||
# symbolic links and aliases may be used to point to other locations.
|
||||
#
|
||||
DocumentRoot "/Users/midoks/Desktop/mwdev/server/apache/httpd/htdocs"
|
||||
<Directory "/Users/midoks/Desktop/mwdev/server/apache/httpd/htdocs">
|
||||
#
|
||||
# Possible values for the Options directive are "None", "All",
|
||||
# or any combination of:
|
||||
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
|
||||
#
|
||||
# Note that "MultiViews" must be named *explicitly* --- "Options All"
|
||||
# doesn't give it to you.
|
||||
#
|
||||
# The Options directive is both complicated and important. Please see
|
||||
# http://httpd.apache.org/docs/2.4/mod/core.html#options
|
||||
# for more information.
|
||||
#
|
||||
Options Indexes FollowSymLinks
|
||||
|
||||
#
|
||||
# AllowOverride controls what directives may be placed in .htaccess files.
|
||||
# It can be "All", "None", or any combination of the keywords:
|
||||
# AllowOverride FileInfo AuthConfig Limit
|
||||
#
|
||||
AllowOverride None
|
||||
|
||||
#
|
||||
# Controls who can get stuff from this server.
|
||||
#
|
||||
Require all granted
|
||||
</Directory>
|
||||
|
||||
#
|
||||
# DirectoryIndex: sets the file that Apache will serve if a directory
|
||||
# is requested.
|
||||
#
|
||||
<IfModule dir_module>
|
||||
DirectoryIndex index.html
|
||||
</IfModule>
|
||||
|
||||
#
|
||||
# The following lines prevent .htaccess and .htpasswd files from being
|
||||
# viewed by Web clients.
|
||||
#
|
||||
<Files ".ht*">
|
||||
Require all denied
|
||||
</Files>
|
||||
|
||||
#
|
||||
# ErrorLog: The location of the error log file.
|
||||
# If you do not specify an ErrorLog directive within a <VirtualHost>
|
||||
# container, error messages relating to that virtual host will be
|
||||
# logged here. If you *do* define an error logfile for a <VirtualHost>
|
||||
# container, that host's errors will be logged there and not here.
|
||||
#
|
||||
ErrorLog "logs/error_log"
|
||||
|
||||
#
|
||||
# LogLevel: Control the number of messages logged to the error_log.
|
||||
# Possible values include: debug, info, notice, warn, error, crit,
|
||||
# alert, emerg.
|
||||
#
|
||||
LogLevel warn
|
||||
|
||||
<IfModule log_config_module>
|
||||
#
|
||||
# The following directives define some format nicknames for use with
|
||||
# a CustomLog directive (see below).
|
||||
#
|
||||
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
|
||||
LogFormat "%h %l %u %t \"%r\" %>s %b" common
|
||||
|
||||
<IfModule logio_module>
|
||||
# You need to enable mod_logio.c to use %I and %O
|
||||
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio
|
||||
</IfModule>
|
||||
|
||||
#
|
||||
# The location and format of the access logfile (Common Logfile Format).
|
||||
# If you do not define any access logfiles within a <VirtualHost>
|
||||
# container, they will be logged here. Contrariwise, if you *do*
|
||||
# define per-<VirtualHost> access logfiles, transactions will be
|
||||
# logged therein and *not* in this file.
|
||||
#
|
||||
CustomLog "logs/access_log" common
|
||||
|
||||
#
|
||||
# If you prefer a logfile with access, agent, and referer information
|
||||
# (Combined Logfile Format) you can use the following directive.
|
||||
#
|
||||
#CustomLog "logs/access_log" combined
|
||||
</IfModule>
|
||||
|
||||
<IfModule alias_module>
|
||||
#
|
||||
# Redirect: Allows you to tell clients about documents that used to
|
||||
# exist in your server's namespace, but do not anymore. The client
|
||||
# will make a new request for the document at its new location.
|
||||
# Example:
|
||||
# Redirect permanent /foo http://www.example.com/bar
|
||||
|
||||
#
|
||||
# Alias: Maps web paths into filesystem paths and is used to
|
||||
# access content that does not live under the DocumentRoot.
|
||||
# Example:
|
||||
# Alias /webpath /full/filesystem/path
|
||||
#
|
||||
# If you include a trailing / on /webpath then the server will
|
||||
# require it to be present in the URL. You will also likely
|
||||
# need to provide a <Directory> section to allow access to
|
||||
# the filesystem path.
|
||||
|
||||
#
|
||||
# ScriptAlias: This controls which directories contain server scripts.
|
||||
# ScriptAliases are essentially the same as Aliases, except that
|
||||
# documents in the target directory are treated as applications and
|
||||
# run by the server when requested rather than as documents sent to the
|
||||
# client. The same rules about trailing "/" apply to ScriptAlias
|
||||
# directives as to Alias.
|
||||
#
|
||||
ScriptAlias /cgi-bin/ "/Users/midoks/Desktop/mwdev/server/apache/httpd/cgi-bin/"
|
||||
|
||||
</IfModule>
|
||||
|
||||
<IfModule cgid_module>
|
||||
#
|
||||
# ScriptSock: On threaded servers, designate the path to the UNIX
|
||||
# socket used to communicate with the CGI daemon of mod_cgid.
|
||||
#
|
||||
#Scriptsock cgisock
|
||||
</IfModule>
|
||||
|
||||
#
|
||||
# "/Users/midoks/Desktop/mwdev/server/apache/httpd/cgi-bin" should be changed to whatever your ScriptAliased
|
||||
# CGI directory exists, if you have that configured.
|
||||
#
|
||||
<Directory "/Users/midoks/Desktop/mwdev/server/apache/httpd/cgi-bin">
|
||||
AllowOverride None
|
||||
Options None
|
||||
Require all granted
|
||||
</Directory>
|
||||
|
||||
<IfModule headers_module>
|
||||
#
|
||||
# Avoid passing HTTP_PROXY environment to CGI's on this or any proxied
|
||||
# backend servers which have lingering "httpoxy" defects.
|
||||
# 'Proxy' request header is undefined by the IETF, not listed by IANA
|
||||
#
|
||||
RequestHeader unset Proxy early
|
||||
</IfModule>
|
||||
|
||||
<IfModule mime_module>
|
||||
#
|
||||
# TypesConfig points to the file containing the list of mappings from
|
||||
# filename extension to MIME-type.
|
||||
#
|
||||
TypesConfig conf/mime.types
|
||||
|
||||
#
|
||||
# AddType allows you to add to or override the MIME configuration
|
||||
# file specified in TypesConfig for specific file types.
|
||||
#
|
||||
#AddType application/x-gzip .tgz
|
||||
#
|
||||
# AddEncoding allows you to have certain browsers uncompress
|
||||
# information on the fly. Note: Not all browsers support this.
|
||||
#
|
||||
#AddEncoding x-compress .Z
|
||||
#AddEncoding x-gzip .gz .tgz
|
||||
#
|
||||
# If the AddEncoding directives above are commented-out, then you
|
||||
# probably should define those extensions to indicate media types:
|
||||
#
|
||||
AddType application/x-compress .Z
|
||||
AddType application/x-gzip .gz .tgz
|
||||
|
||||
#
|
||||
# AddHandler allows you to map certain file extensions to "handlers":
|
||||
# actions unrelated to filetype. These can be either built into the server
|
||||
# or added with the Action directive (see below)
|
||||
#
|
||||
# To use CGI scripts outside of ScriptAliased directories:
|
||||
# (You will also need to add "ExecCGI" to the "Options" directive.)
|
||||
#
|
||||
#AddHandler cgi-script .cgi
|
||||
|
||||
# For type maps (negotiated resources):
|
||||
#AddHandler type-map var
|
||||
|
||||
#
|
||||
# Filters allow you to process content before it is sent to the client.
|
||||
#
|
||||
# To parse .shtml files for server-side includes (SSI):
|
||||
# (You will also need to add "Includes" to the "Options" directive.)
|
||||
#
|
||||
#AddType text/html .shtml
|
||||
#AddOutputFilter INCLUDES .shtml
|
||||
</IfModule>
|
||||
|
||||
#
|
||||
# The mod_mime_magic module allows the server to use various hints from the
|
||||
# contents of the file itself to determine its type. The MIMEMagicFile
|
||||
# directive tells the module where the hint definitions are located.
|
||||
#
|
||||
#MIMEMagicFile conf/magic
|
||||
|
||||
#
|
||||
# Customizable error responses come in three flavors:
|
||||
# 1) plain text 2) local redirects 3) external redirects
|
||||
#
|
||||
# Some examples:
|
||||
#ErrorDocument 500 "The server made a boo boo."
|
||||
#ErrorDocument 404 /missing.html
|
||||
#ErrorDocument 404 "/cgi-bin/missing_handler.pl"
|
||||
#ErrorDocument 402 http://www.example.com/subscription_info.html
|
||||
#
|
||||
|
||||
#
|
||||
# MaxRanges: Maximum number of Ranges in a request before
|
||||
# returning the entire resource, or one of the special
|
||||
# values 'default', 'none' or 'unlimited'.
|
||||
# Default setting is to accept 200 Ranges.
|
||||
#MaxRanges unlimited
|
||||
|
||||
#
|
||||
# EnableMMAP and EnableSendfile: On systems that support it,
|
||||
# memory-mapping or the sendfile syscall may be used to deliver
|
||||
# files. This usually improves server performance, but must
|
||||
# be turned off when serving from networked-mounted
|
||||
# filesystems or if support for these functions is otherwise
|
||||
# broken on your system.
|
||||
# Defaults: EnableMMAP On, EnableSendfile Off
|
||||
#
|
||||
#EnableMMAP off
|
||||
#EnableSendfile on
|
||||
|
||||
# Supplemental configuration
|
||||
#
|
||||
# The configuration files in the conf/extra/ directory can be
|
||||
# included to add extra features or to modify the default configuration of
|
||||
# the server, or you may simply copy their contents here and change as
|
||||
# necessary.
|
||||
|
||||
# Server-pool management (MPM specific)
|
||||
#Include conf/extra/httpd-mpm.conf
|
||||
|
||||
# Multi-language error messages
|
||||
#Include conf/extra/httpd-multilang-errordoc.conf
|
||||
|
||||
# Fancy directory listings
|
||||
#Include conf/extra/httpd-autoindex.conf
|
||||
|
||||
# Language settings
|
||||
#Include conf/extra/httpd-languages.conf
|
||||
|
||||
# User home directories
|
||||
#Include conf/extra/httpd-userdir.conf
|
||||
|
||||
# Real-time info on requests and configuration
|
||||
#Include conf/extra/httpd-info.conf
|
||||
|
||||
# Virtual hosts
|
||||
#Include conf/extra/httpd-vhosts.conf
|
||||
|
||||
# Local access to the Apache HTTP Server Manual
|
||||
#Include conf/extra/httpd-manual.conf
|
||||
|
||||
# Distributed authoring and versioning (WebDAV)
|
||||
#Include conf/extra/httpd-dav.conf
|
||||
|
||||
# Various default settings
|
||||
#Include conf/extra/httpd-default.conf
|
||||
|
||||
# Configure mod_proxy_html to understand HTML4/XHTML1
|
||||
<IfModule proxy_html_module>
|
||||
Include conf/extra/proxy-html.conf
|
||||
</IfModule>
|
||||
|
||||
# Secure (SSL/TLS) connections
|
||||
#Include conf/extra/httpd-ssl.conf
|
||||
#
|
||||
# Note: The following must must be present to support
|
||||
# starting without SSL on platforms with no /dev/random equivalent
|
||||
# but a statically compiled-in mod_ssl.
|
||||
#
|
||||
<IfModule ssl_module>
|
||||
SSLRandomSeed startup builtin
|
||||
SSLRandomSeed connect builtin
|
||||
</IfModule>
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 1.4 KiB |
Executable
+25
@@ -0,0 +1,25 @@
|
||||
<div class="bt-form">
|
||||
<!-- <div class='plugin_version'></div> -->
|
||||
<div class="bt-w-main">
|
||||
<div class="bt-w-menu">
|
||||
<p class="bgw" onclick="httpPluginService('apache',$('.plugin_version').attr('version'));">服务</p>
|
||||
<p onclick="pluginInitD('apache', $('.plugin_version').attr('version'));">自启动</p>
|
||||
<p onclick="pluginConfig('apache');">配置修改</p>
|
||||
<p onclick="getHttpdStatus();">负载状态</p>
|
||||
<p onclick="setOpCfg();">MPM性能调整</p>
|
||||
<p onclick="pluginLogs('apache');">错误日志</p>
|
||||
<p onclick="otherFunc();">维护功能</p>
|
||||
</div>
|
||||
<div class="bt-w-con pd15">
|
||||
<div class="soft-man-con" style="height: 500px; overflow-y: auto;"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
// resetPluginWinHeight(600);
|
||||
$.getScript( "/plugins/file?name=apache&f=js/httpd.js", function(){
|
||||
httpPluginService('apache');
|
||||
});
|
||||
</script>
|
||||
Executable
+593
@@ -0,0 +1,593 @@
|
||||
# coding:utf-8
|
||||
|
||||
import sys
|
||||
import io
|
||||
import os
|
||||
import time
|
||||
import threading
|
||||
import subprocess
|
||||
import re
|
||||
|
||||
|
||||
web_dir = os.getcwd() + "/web"
|
||||
if os.path.exists(web_dir):
|
||||
sys.path.append(web_dir)
|
||||
os.chdir(web_dir)
|
||||
|
||||
import core.mw as mw
|
||||
|
||||
app_debug = False
|
||||
if mw.isAppleSystem():
|
||||
app_debug = True
|
||||
|
||||
|
||||
def getPluginName():
|
||||
return 'apache'
|
||||
|
||||
|
||||
def getPluginDir():
|
||||
return mw.getPluginDir() + '/' + getPluginName()
|
||||
|
||||
|
||||
def getServerDir():
|
||||
return mw.getServerDir() + '/' + getPluginName()
|
||||
|
||||
|
||||
def getInitDFile():
|
||||
current_os = mw.getOs()
|
||||
if current_os == 'darwin':
|
||||
return '/tmp/' + getPluginName()
|
||||
|
||||
if current_os.startswith('freebsd'):
|
||||
return '/etc/rc.d/' + getPluginName()
|
||||
|
||||
return '/etc/init.d/' + getPluginName()
|
||||
|
||||
|
||||
def getArgs():
|
||||
args = sys.argv[2:]
|
||||
# print(args)
|
||||
tmp = {}
|
||||
args_len = len(args)
|
||||
|
||||
if args_len == 1:
|
||||
t = args[0].strip('{').strip('}')
|
||||
t = t.split(':',2)
|
||||
tmp[t[0]] = t[1]
|
||||
elif args_len > 1:
|
||||
for i in range(len(args)):
|
||||
t = args[i].split(':',2)
|
||||
tmp[t[0]] = t[1]
|
||||
# print(tmp)
|
||||
return tmp
|
||||
|
||||
|
||||
def checkArgs(data, ck=[]):
|
||||
for i in range(len(ck)):
|
||||
if not ck[i] in data:
|
||||
return (False, mw.returnJson(False, '参数:(' + ck[i] + ')没有!'))
|
||||
return (True, mw.returnJson(True, 'ok'))
|
||||
|
||||
|
||||
def clearTemp():
|
||||
path_bin = getServerDir() + "/httpd"
|
||||
|
||||
|
||||
def getConf():
|
||||
path = getServerDir() + "/httpd/conf/httpd.conf"
|
||||
return path
|
||||
|
||||
|
||||
def getConfMpm():
|
||||
path = getServerDir() + "/httpd/conf/extra/httpd-mpm.conf"
|
||||
return path
|
||||
|
||||
|
||||
def getConfTpl():
|
||||
path = getPluginDir() + '/conf/httpd.conf'
|
||||
return path
|
||||
|
||||
|
||||
def getOs():
|
||||
data = {}
|
||||
data['os'] = mw.getOs()
|
||||
data['auth'] = True
|
||||
return mw.getJson(data)
|
||||
|
||||
|
||||
def getInitDTpl():
|
||||
path = getPluginDir() + "/init.d/httpd.tpl"
|
||||
return path
|
||||
|
||||
|
||||
def getPidFile():
|
||||
file = getConf()
|
||||
content = mw.readFile(file)
|
||||
rep = r'pid\s*(.*);'
|
||||
tmp = re.search(rep, content)
|
||||
return tmp.groups()[0].strip()
|
||||
|
||||
|
||||
def getFileOwner(filename):
|
||||
import pwd
|
||||
stat = os.lstat(filename)
|
||||
uid = stat.st_uid
|
||||
pw = pwd.getpwuid(uid)
|
||||
return pw.pw_name
|
||||
|
||||
|
||||
def checkAuthEq(file, owner='root'):
|
||||
fowner = getFileOwner(file)
|
||||
if (fowner == owner):
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
def confReplace():
|
||||
service_path = mw.getServerDir()
|
||||
content = mw.readFile(getConfTpl())
|
||||
content = content.replace('{$SERVER_PATH}', service_path)
|
||||
|
||||
# 主配置文件
|
||||
nconf = getServerDir() + '/httpd/conf/httpd.conf'
|
||||
mw.writeFile(nconf, content)
|
||||
|
||||
|
||||
def initDreplace():
|
||||
|
||||
file_tpl = getInitDTpl()
|
||||
service_path = mw.getServerDir()
|
||||
|
||||
initD_path = getServerDir() + '/init.d'
|
||||
|
||||
# OpenResty is not installed
|
||||
if not os.path.exists(getServerDir()):
|
||||
print("ok")
|
||||
exit(0)
|
||||
|
||||
# init.d
|
||||
file_bin = initD_path + '/' + getPluginName()
|
||||
if not os.path.exists(initD_path):
|
||||
os.mkdir(initD_path)
|
||||
|
||||
# initd replace
|
||||
content = mw.readFile(file_tpl)
|
||||
content = content.replace('{$SERVER_PATH}', service_path)
|
||||
mw.writeFile(file_bin, content)
|
||||
mw.execShell('chmod +x ' + file_bin)
|
||||
|
||||
# config replace
|
||||
confReplace()
|
||||
|
||||
# systemd
|
||||
# /usr/lib/systemd/system
|
||||
systemDir = mw.systemdCfgDir()
|
||||
systemService = systemDir + '/httpd.service'
|
||||
if os.path.exists(systemDir) and not os.path.exists(systemService):
|
||||
systemServiceTpl = getPluginDir() + '/init.d/httpd.service.tpl'
|
||||
se_content = mw.readFile(systemServiceTpl)
|
||||
se_content = se_content.replace('{$SERVER_PATH}', service_path)
|
||||
mw.writeFile(systemService, se_content)
|
||||
mw.execShell('systemctl daemon-reload')
|
||||
|
||||
return file_bin
|
||||
|
||||
|
||||
def status():
|
||||
cmd = "ps -ef|grep 'httpd' |grep -v grep | grep -v python | awk '{print $2}'"
|
||||
data = mw.execShell(cmd)
|
||||
if data[0] == '':
|
||||
return 'stop'
|
||||
return 'start'
|
||||
|
||||
|
||||
def restyOp(method):
|
||||
file = initDreplace()
|
||||
|
||||
# 启动时,先检查一下配置文件
|
||||
check = getServerDir() + "/httpd/bin/httpd -t"
|
||||
check_data = mw.execShell(check)
|
||||
if not check_data[1].find('Syntax OK') > -1:
|
||||
return check_data[1]
|
||||
|
||||
current_os = mw.getOs()
|
||||
if current_os == "darwin":
|
||||
data = mw.execShell(file + ' ' + method)
|
||||
if data[1] == '':
|
||||
return 'ok'
|
||||
return data[1]
|
||||
|
||||
if current_os.startswith("freebsd"):
|
||||
mw.execShell('service httpd '+method)
|
||||
if data[1] == '':
|
||||
return 'ok'
|
||||
return data[1]
|
||||
|
||||
data = mw.execShell('systemctl ' + method + ' httpd')
|
||||
if data[1] == '':
|
||||
return 'ok'
|
||||
return data[1]
|
||||
|
||||
|
||||
def op_submit_systemctl_restart():
|
||||
current_os = mw.getOs()
|
||||
if current_os.startswith("freebsd"):
|
||||
mw.execShell('service httpd restart')
|
||||
return True
|
||||
|
||||
mw.execShell('systemctl restart httpd')
|
||||
return True
|
||||
|
||||
|
||||
def op_submit_init_restart(file):
|
||||
mw.execShell(file + ' restart')
|
||||
|
||||
|
||||
def restyOp_restart():
|
||||
file = initDreplace()
|
||||
|
||||
# 启动时,先检查一下配置文件
|
||||
check = getServerDir() + "/httpd/bin/httpd -t"
|
||||
check_data = mw.execShell(check)
|
||||
if not check_data[1].find('Syntax OK') > -1:
|
||||
return 'ERROR: 配置出错<br><a style="color:red;">' + check_data[1].replace("\n", '<br>') + '</a>'
|
||||
|
||||
if not mw.isAppleSystem():
|
||||
threading.Timer(2, op_submit_systemctl_restart).start()
|
||||
return 'ok'
|
||||
|
||||
threading.Timer(2, op_submit_init_restart, args=(file,)).start()
|
||||
return 'ok'
|
||||
|
||||
|
||||
def start():
|
||||
return restyOp('start')
|
||||
|
||||
|
||||
def stop():
|
||||
r = restyOp('stop')
|
||||
|
||||
mw.execShell("ps -ef|grep httpd | grep -v grep | awk '{print $2}'|xargs -r kill")
|
||||
return r
|
||||
|
||||
|
||||
def restart():
|
||||
return restyOp_restart()
|
||||
|
||||
|
||||
def reload():
|
||||
confReplace()
|
||||
return restyOp('reload')
|
||||
|
||||
|
||||
def initdStatus():
|
||||
current_os = mw.getOs()
|
||||
if current_os == 'darwin':
|
||||
return "Apple Computer does not support"
|
||||
|
||||
if current_os.startswith('freebsd'):
|
||||
initd_bin = getInitDFile()
|
||||
if os.path.exists(initd_bin):
|
||||
return 'ok'
|
||||
|
||||
shell_cmd = 'systemctl status httpd | grep loaded | grep "enabled;"'
|
||||
data = mw.execShell(shell_cmd)
|
||||
if data[0] == '':
|
||||
return 'fail'
|
||||
return 'ok'
|
||||
|
||||
|
||||
def initdInstall():
|
||||
current_os = mw.getOs()
|
||||
if current_os == 'darwin':
|
||||
return "Apple Computer does not support"
|
||||
|
||||
# freebsd initd install
|
||||
if current_os.startswith('freebsd'):
|
||||
import shutil
|
||||
source_bin = initDreplace()
|
||||
initd_bin = getInitDFile()
|
||||
shutil.copyfile(source_bin, initd_bin)
|
||||
mw.execShell('chmod +x ' + initd_bin)
|
||||
mw.execShell('sysrc httpd_enable="YES"')
|
||||
return 'ok'
|
||||
|
||||
mw.execShell('systemctl enable httpd')
|
||||
return 'ok'
|
||||
|
||||
|
||||
def initdUinstall():
|
||||
current_os = mw.getOs()
|
||||
if current_os == 'darwin':
|
||||
return "Apple Computer does not support"
|
||||
|
||||
if current_os.startswith('freebsd'):
|
||||
initd_bin = getInitDFile()
|
||||
os.remove(initd_bin)
|
||||
mw.execShell('sysrc httpd_enable="NO"')
|
||||
return 'ok'
|
||||
|
||||
mw.execShell('systemctl disable httpd')
|
||||
return 'ok'
|
||||
|
||||
def getHttpdStatusPort():
|
||||
conf = mw.getServerDir() + '/apache/httpd/conf/httpd.conf'
|
||||
content = mw.readFile(conf)
|
||||
if not content:
|
||||
return None
|
||||
rep = r'^\s*Listen\s*(?:\d+\.\d+\.\d+\.\d+:)?(\d+)' # 匹配非注释行的 Listen 指令,忽略大小写
|
||||
tmp = re.search(rep, content, re.IGNORECASE | re.MULTILINE)
|
||||
if tmp:
|
||||
port = tmp.groups()[0].strip()
|
||||
return port
|
||||
return None
|
||||
|
||||
|
||||
def runInfoDone(data):
|
||||
result = {}
|
||||
if not data:
|
||||
return result
|
||||
|
||||
# 解析服务器状态数据
|
||||
lines = data.strip().split('\n')
|
||||
for line in lines:
|
||||
if ':' in line:
|
||||
key, value = line.split(':', 1)
|
||||
key = key.strip()
|
||||
value = value.strip()
|
||||
result[key] = value
|
||||
|
||||
return result
|
||||
|
||||
|
||||
def runInfo():
|
||||
op_status = status()
|
||||
if op_status == 'stop':
|
||||
return mw.returnJson(False, "未启动!")
|
||||
|
||||
port = getHttpdStatusPort()
|
||||
if not port:
|
||||
return mw.returnJson(False, "无法获取端口信息!")
|
||||
|
||||
# 取Openresty负载状态
|
||||
try:
|
||||
url = 'http://127.0.0.1:%s/server-status?auto' % port
|
||||
result = mw.httpGet(url, timeout=3)
|
||||
data = runInfoDone(result)
|
||||
return mw.getJson(data)
|
||||
except Exception as e:
|
||||
try:
|
||||
url = 'http://' + mw.getHostAddr() + ':%s/server-status?auto' % port
|
||||
result = mw.httpGet(url)
|
||||
data = runInfoDone(result)
|
||||
return mw.getJson(data)
|
||||
except Exception as e:
|
||||
return mw.returnJson(False, "apache异常!")
|
||||
|
||||
except Exception as e:
|
||||
return mw.returnJson(False, "apache not started!")
|
||||
|
||||
|
||||
def errorLogPath():
|
||||
return getServerDir() + '/httpd/logs/error.log'
|
||||
|
||||
|
||||
def getCfg():
|
||||
cfg = getConfMpm()
|
||||
content = mw.readFile(cfg)
|
||||
|
||||
unitrep = "[kmgKMG]"
|
||||
|
||||
# 获取当前 MPM 模块
|
||||
mpm_module = ""
|
||||
mpm_match = re.search(r"mpm_(\w+)_module", content)
|
||||
if mpm_match:
|
||||
mpm_module = mpm_match.group(1)
|
||||
|
||||
# MPM 配置参数
|
||||
mpm_cfg_args = {
|
||||
"prefork": [
|
||||
{"name": "StartServers", "ps": "服务器进程启动数量", 'type': 2},
|
||||
{"name": "MinSpareServers", "ps": "保持空闲的最小服务器进程数", 'type': 2},
|
||||
{"name": "MaxSpareServers", "ps": "保持空闲的最大服务器进程数", 'type': 2},
|
||||
{"name": "MaxRequestWorkers", "ps": "允许启动的最大服务器进程数", 'type': 2},
|
||||
{"name": "MaxConnectionsPerChild", "ps": "服务器进程服务的最大连接数", 'type': 2},
|
||||
],
|
||||
"worker": [
|
||||
{"name": "StartServers", "ps": "初始服务器进程数", 'type': 2},
|
||||
{"name": "MinSpareThreads", "ps": "保持空闲的最小工作线程数", 'type': 2},
|
||||
{"name": "MaxSpareThreads", "ps": "保持空闲的最大工作线程数", 'type': 2},
|
||||
{"name": "ThreadsPerChild", "ps": "每个服务器进程的工作线程数", 'type': 2},
|
||||
{"name": "MaxRequestWorkers", "ps": "最大工作线程数", 'type': 2},
|
||||
{"name": "MaxConnectionsPerChild", "ps": "服务器进程服务的最大连接数", 'type': 2},
|
||||
],
|
||||
"event": [
|
||||
{"name": "StartServers", "ps": "初始服务器进程数", 'type': 2},
|
||||
{"name": "MinSpareThreads", "ps": "保持空闲的最小工作线程数", 'type': 2},
|
||||
{"name": "MaxSpareThreads", "ps": "保持空闲的最大工作线程数", 'type': 2},
|
||||
{"name": "ThreadsPerChild", "ps": "每个服务器进程的工作线程数", 'type': 2},
|
||||
{"name": "MaxRequestWorkers", "ps": "最大工作线程数", 'type': 2},
|
||||
{"name": "MaxConnectionsPerChild", "ps": "服务器进程服务的最大连接数", 'type': 2},
|
||||
],
|
||||
"netware": [
|
||||
{"name": "ThreadStackSize", "ps": "每个工作线程分配的堆栈大小", 'type': 2},
|
||||
{"name": "StartThreads", "ps": "服务器启动时启动的工作线程数", 'type': 2},
|
||||
{"name": "MinSpareThreads", "ps": "保持空闲的最小线程数", 'type': 2},
|
||||
{"name": "MaxSpareThreads", "ps": "保持空闲的最大线程数", 'type': 2},
|
||||
{"name": "MaxThreads", "ps": "同时活跃的最大工作线程数", 'type': 2},
|
||||
{"name": "MaxConnectionsPerChild", "ps": "线程服务的最大连接数", 'type': 2},
|
||||
],
|
||||
"mpmt_os2": [
|
||||
{"name": "StartServers", "ps": "维护的服务器进程数", 'type': 2},
|
||||
{"name": "MinSpareThreads", "ps": "每个进程的最小空闲线程数", 'type': 2},
|
||||
{"name": "MaxSpareThreads", "ps": "每个进程的最大空闲线程数", 'type': 2},
|
||||
{"name": "MaxConnectionsPerChild", "ps": "每个服务器进程的最大连接数", 'type': 2},
|
||||
],
|
||||
"winnt": [
|
||||
{"name": "ThreadsPerChild", "ps": "服务器进程中的工作线程数", 'type': 2},
|
||||
{"name": "MaxConnectionsPerChild", "ps": "服务器进程服务的最大连接数", 'type': 2},
|
||||
]
|
||||
}
|
||||
|
||||
# 通用配置参数
|
||||
common_cfg_args = [
|
||||
{"name": "MaxMemFree", "ps": "每个分配器允许持有的最大空闲KB数", 'type': 2},
|
||||
]
|
||||
|
||||
# 合并配置参数
|
||||
cfg_args = []
|
||||
if mpm_module in mpm_cfg_args:
|
||||
cfg_args.extend(mpm_cfg_args[mpm_module])
|
||||
cfg_args.extend(common_cfg_args)
|
||||
|
||||
rdata = []
|
||||
for i in cfg_args:
|
||||
# 匹配 MPM 特定配置
|
||||
rep = r"<IfModule mpm_%s_module>.*?(%s)\s+(\w+).*?</IfModule>" % (mpm_module, i["name"])
|
||||
k = re.search(rep, content, re.DOTALL)
|
||||
|
||||
# 如果没有找到 MPM 特定配置,尝试匹配通用配置
|
||||
if not k:
|
||||
rep = r"(%s)\s+(\w+)" % i["name"]
|
||||
k = re.search(rep, content)
|
||||
|
||||
if not k:
|
||||
continue
|
||||
|
||||
key = k.group(1)
|
||||
v = k.group(2) if len(k.groups()) > 1 else ""
|
||||
|
||||
if re.search(unitrep, v):
|
||||
u = str.upper(v[-1])
|
||||
v = v[:-1]
|
||||
if len(u) == 1:
|
||||
psstr = u + "B," + i["ps"]
|
||||
else:
|
||||
psstr = u + "," + i["ps"]
|
||||
else:
|
||||
u = ""
|
||||
|
||||
kv = {"name": key, "value": v, "unit": u,
|
||||
"ps": i["ps"], "type": i["type"]}
|
||||
rdata.append(kv)
|
||||
return mw.returnJson(True, "ok", rdata)
|
||||
|
||||
def replaceChar(value, index, new_char):
|
||||
return value[:index] + new_char + value[index+1:]
|
||||
|
||||
def setCfg():
|
||||
args = getArgs()
|
||||
|
||||
# 检查参数,允许动态参数
|
||||
cfg = getConfMpm()
|
||||
mw.backFile(cfg)
|
||||
content = mw.readFile(cfg)
|
||||
|
||||
# 获取当前 MPM 模块
|
||||
mpm_module = ""
|
||||
mpm_match = re.search(r"mpm_(\w+)_module", content)
|
||||
if mpm_match:
|
||||
mpm_module = mpm_match.group(1)
|
||||
|
||||
# 验证参数值
|
||||
for k, v in args.items():
|
||||
# 检查是否为数字参数
|
||||
if not re.search(r"\d+", v):
|
||||
return mw.returnJson(False, '参数值错误,请输入数字整数')
|
||||
|
||||
# 替换 MPM 特定配置
|
||||
if mpm_module:
|
||||
def replace_mpm_config(match):
|
||||
return match.group(1) + k + match.group(2) + v + match.group(3)
|
||||
rep = r"(<IfModule mpm_%s_module>.*?)%s(\s+)\d+(.*?</IfModule>)" % (mpm_module, k)
|
||||
if re.search(rep, content, re.DOTALL):
|
||||
content = re.sub(rep, replace_mpm_config, content, flags=re.DOTALL)
|
||||
|
||||
# 替换通用配置
|
||||
def replace_common_config(match):
|
||||
return k + match.group(1) + v
|
||||
rep = r"%s(\s+)\d+" % k
|
||||
if re.search(rep, content):
|
||||
content = re.sub(rep, replace_common_config, content)
|
||||
|
||||
mw.writeFile(cfg, content)
|
||||
isError = mw.checkHttpdConfig()
|
||||
if (isError != True):
|
||||
mw.restoreFile(cfg)
|
||||
return mw.returnJson(False, 'ERROR: 配置出错<br><a style="color:red;">' + isError.replace("\n", '<br>') + '</a>')
|
||||
|
||||
mw.restartWeb()
|
||||
return mw.returnJson(True, '设置成功')
|
||||
|
||||
|
||||
def cronAddCheck():
|
||||
try:
|
||||
import tool_task
|
||||
tool_task.createBgTask()
|
||||
return mw.returnJson(True, '添加检查任务成功')
|
||||
except Exception as e:
|
||||
return mw.returnJson(False, '添加检查任务失败:'+str(e))
|
||||
|
||||
def cronDelCheck():
|
||||
try:
|
||||
import tool_task
|
||||
tool_task.removeBgTask()
|
||||
return mw.returnJson(True, '删除检查任务成功')
|
||||
except Exception as e:
|
||||
return mw.returnJson(False, '删除检查任务失败:'+str(e))
|
||||
|
||||
def cronCheck():
|
||||
return 'ok'
|
||||
|
||||
|
||||
def installPreInspection():
|
||||
return 'ok'
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
version = '2.4'
|
||||
version_pl = getServerDir() + "/version.pl"
|
||||
if os.path.exists(version_pl):
|
||||
version = mw.readFile(version_pl)
|
||||
|
||||
|
||||
func = sys.argv[1]
|
||||
if func == 'status':
|
||||
print(status())
|
||||
elif func == 'start':
|
||||
print(start())
|
||||
elif func == 'stop':
|
||||
print(stop())
|
||||
elif func == 'restart':
|
||||
print(restart())
|
||||
elif func == 'reload':
|
||||
print(reload())
|
||||
elif func == 'initd_status':
|
||||
print(initdStatus())
|
||||
elif func == 'initd_install':
|
||||
print(initdInstall())
|
||||
elif func == 'initd_uninstall':
|
||||
print(initdUinstall())
|
||||
elif func == 'install_pre_inspection':
|
||||
print(installPreInspection())
|
||||
elif func == 'conf':
|
||||
print(getConf())
|
||||
elif func == 'get_os':
|
||||
print(getOs())
|
||||
elif func == 'run_info':
|
||||
print(runInfo())
|
||||
elif func == 'error_log':
|
||||
print(errorLogPath())
|
||||
elif func == 'get_cfg':
|
||||
print(getCfg())
|
||||
elif func == 'set_cfg':
|
||||
print(setCfg())
|
||||
elif func == 'check':
|
||||
print(cronCheck())
|
||||
elif func == 'cron_add_check':
|
||||
print(cronAddCheck())
|
||||
elif func == 'cron_del_check':
|
||||
print(cronDelCheck())
|
||||
else:
|
||||
print('error')
|
||||
Executable
+18
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"sort": 0,
|
||||
"title":"apache",
|
||||
"tip":"soft",
|
||||
"name":"apache",
|
||||
"type":"其他插件",
|
||||
"ps":"世界排名第一,快速、可靠并且可通过简单的API扩充",
|
||||
"shell":"install.sh",
|
||||
"install_pre_inspection":true,
|
||||
"checks":"server/apache",
|
||||
"path":"server/apache",
|
||||
"author":"apache",
|
||||
"home":"https://downloads.apache.org/httpd/",
|
||||
"date":"2026-04-11",
|
||||
"pid": "1",
|
||||
"versions": ["2.4"],
|
||||
"updates": ["2.4:66"]
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
[Unit]
|
||||
Description=Apache Web Server
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
Environment=LANG=C
|
||||
ExecStart={$SERVER_PATH}/apache/httpd/bin/httpd $OPTIONS -DFOREGROUND
|
||||
ExecReload={$SERVER_PATH}/apache/httpd/bin/httpd $OPTIONS -k graceful
|
||||
KillSignal=SIGWINCH
|
||||
|
||||
KillMode=mixed
|
||||
PrivateTmp=true
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
@@ -0,0 +1,17 @@
|
||||
[Unit]
|
||||
Description=Apache Web Server
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
Type=forking
|
||||
PIDFile={$SERVER_PATH}/apache/httpd/logs/httpd.pid
|
||||
ExecStart={$SERVER_PATH}/apache/httpd/bin/apachectl start
|
||||
ExecReload={$SERVER_PATH}/apache/httpd/bin/apachectl graceful
|
||||
ExecStop={$SERVER_PATH}/apache/httpd/bin/apachectl stop
|
||||
PrivateTmp=true
|
||||
User=www
|
||||
Group=www
|
||||
Restart=on-failure
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
@@ -0,0 +1,47 @@
|
||||
#!/bin/bash
|
||||
# chkconfig: 345 85 15
|
||||
# description: Apache Server
|
||||
|
||||
### BEGIN INIT INFO
|
||||
# Provides: apache
|
||||
# Required-Start: $network
|
||||
# Required-Stop: $network
|
||||
# Default-Start: 2 3 4 5
|
||||
# Default-Stop: 0 1 6
|
||||
# Description: Apache Server
|
||||
### END INIT INFO
|
||||
|
||||
|
||||
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/opt/homebrew/bin
|
||||
# Apache 可执行文件的路径
|
||||
DAEMON={$SERVER_PATH}/apache/httpd/bin/httpd
|
||||
# 进程的 PID 文件路径
|
||||
PIDFILE={$SERVER_PATH}/apache/httpd/logs/httpd.pid
|
||||
|
||||
# 根据传入的参数执行不同操作
|
||||
case "$1" in
|
||||
start)
|
||||
echo "Starting Apache..."
|
||||
$DAEMON -k start
|
||||
;;
|
||||
stop)
|
||||
echo "Stopping Apache..."
|
||||
$DAEMON -k stop
|
||||
;;
|
||||
restart)
|
||||
echo "Restarting Apache..."
|
||||
$DAEMON -k restart
|
||||
;;
|
||||
status)
|
||||
if [ -f $PIDFILE ]; then
|
||||
echo "Apache is running."
|
||||
else
|
||||
echo "Apache is not running."
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $0 {start|stop|restart|status}"
|
||||
exit 1
|
||||
esac
|
||||
|
||||
exit 0
|
||||
Executable
+87
@@ -0,0 +1,87 @@
|
||||
#!/bin/bash
|
||||
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin:/opt/homebrew/bin
|
||||
export PATH
|
||||
|
||||
# cd /Users/midoks/Desktop/mwdev/server/mdserver-web/plugins/apache && bash install.sh install 2.4
|
||||
# cd /www/server/mdserver-web/plugins/apache && bash install.sh install 2.4
|
||||
# cd /www/server/mdserver-web/plugins/apache && bash install.sh upgrade 2.4
|
||||
|
||||
# curl -I -H "Accept-Encoding: br" http://localhost
|
||||
# curl -I -H "Accept-Encoding: zstd" http://localhost
|
||||
# curl --http3 -v https://www.xxx.com
|
||||
|
||||
# apt install ncat -y
|
||||
# nc -u -v www.xx.com 443
|
||||
|
||||
# cd /Users/midoks/Desktop/mwdev/server/mdserver-web/plugins/apache && python3 plugins/apache/index.py start
|
||||
# cd /www/server/mdserver-web && python3 plugins/apache/index.py start
|
||||
# cd /www/server/mdserver-web && python3 plugins/apache/index.py run_info
|
||||
# ps -ef|grep httpd | grep -v grep | awk '{print $2}'|xargs kill
|
||||
|
||||
curPath=`pwd`
|
||||
rootPath=$(dirname "$curPath")
|
||||
rootPath=$(dirname "$rootPath")
|
||||
serverPath=$(dirname "$rootPath")
|
||||
|
||||
sysName=`uname`
|
||||
action=$1
|
||||
type=$2
|
||||
|
||||
VERSION=$2
|
||||
openrestyDir=${serverPath}/source/apache
|
||||
|
||||
if id www &> /dev/null ;then
|
||||
echo "www uid is `id -u www`"
|
||||
echo "www shell is `grep "^www:" /etc/passwd |cut -d':' -f7 `"
|
||||
else
|
||||
groupadd www
|
||||
useradd -g www -s /bin/bash www
|
||||
fi
|
||||
|
||||
if [ "${action}" == "upgrade" ];then
|
||||
sh -x $curPath/versions/$2/install.sh $1
|
||||
|
||||
echo "${VERSION}" > $serverPath/apache/version.pl
|
||||
|
||||
mkdir -p $serverPath/web_conf/php/conf
|
||||
echo 'set $PHP_ENV 0;' > $serverPath/web_conf/php/conf/enable-php-00.conf
|
||||
|
||||
#初始化
|
||||
cd ${rootPath} && python3 ${rootPath}/plugins/apache/index.py start
|
||||
cd ${rootPath} && python3 ${rootPath}/plugins/apache/index.py initd_install
|
||||
exit 0
|
||||
fi
|
||||
|
||||
|
||||
if [ "${2}" == "" ];then
|
||||
echo '缺少安装脚本版本...'
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ "${action}" == "uninstall" ];then
|
||||
if [ -f /usr/lib/systemd/system/httpd.service ] || [ -f /lib/systemd/system/httpd.service ];then
|
||||
systemctl stop httpd
|
||||
rm -rf /usr/systemd/system/httpd.service
|
||||
rm -rf /lib/systemd/system/httpd.service
|
||||
systemctl daemon-reload
|
||||
fi
|
||||
|
||||
if [ -f $serverPath/apache/init.d/httpd ];then
|
||||
$serverPath/apache/init.d/httpd stop
|
||||
fi
|
||||
|
||||
rm -rf $serverPath/apache
|
||||
fi
|
||||
|
||||
sh -x $curPath/versions/$2/install.sh $1
|
||||
|
||||
if [ "${action}" == "install" ] && [ -d $serverPath/apache ];then
|
||||
echo "${VERSION}" > $serverPath/apache/version.pl
|
||||
|
||||
mkdir -p $serverPath/web_conf/php/conf
|
||||
echo 'set $PHP_ENV 0;' > $serverPath/web_conf/php/conf/enable-php-00.conf
|
||||
|
||||
#初始化
|
||||
cd ${rootPath} && python3 ${rootPath}/plugins/apache/index.py start
|
||||
cd ${rootPath} && python3 ${rootPath}/plugins/apache/index.py initd_install
|
||||
fi
|
||||
Executable
+278
@@ -0,0 +1,278 @@
|
||||
function httpPost(method, args, callback){
|
||||
var loadT = layer.msg('正在获取...', { icon: 16, time: 0, shade: 0.3 });
|
||||
$.post('/plugins/run', {name:'apache', func:method, args:JSON.stringify(args)}, function(data) {
|
||||
layer.close(loadT);
|
||||
if (!data.status){
|
||||
layer.msg(data.msg,{icon:0,time:2000,shade: [0.3, '#000']});
|
||||
return;
|
||||
}
|
||||
|
||||
if(typeof(callback) == 'function'){
|
||||
callback(data);
|
||||
}
|
||||
},'json');
|
||||
}
|
||||
|
||||
function httpPluginService(_name, version){
|
||||
var data = {name:_name, func:'status'}
|
||||
if ( typeof(version) != 'undefined' ){
|
||||
data['version'] = version;
|
||||
} else {
|
||||
version = '';
|
||||
}
|
||||
|
||||
httpPost('status', data, function(data){
|
||||
if (data.data == 'start'){
|
||||
orPluginSetService(_name, true, version);
|
||||
} else {
|
||||
orPluginSetService(_name, false, version);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function orPluginSetService(_name ,status, version){
|
||||
var serviceCon ='<p class="status">当前状态:<span>'+(status ? '开启' : '关闭' )+
|
||||
'</span><span style="color: '+
|
||||
(status?'#20a53a;':'red;')+
|
||||
' margin-left: 3px;" class="glyphicon ' + (status?'glyphicon glyphicon-play':'glyphicon-pause')+'"></span></p><div class="sfm-opt">\
|
||||
<button class="btn btn-default btn-sm" onclick="orPluginOpService(\''+_name+'\',\''+(status?'stop':'start')+'\',\''+version+'\')">'+(status?'停止':'启动')+'</button>\
|
||||
<button class="btn btn-default btn-sm" onclick="orPluginOpService(\''+_name+'\',\'restart\',\''+version+'\',\'yes\')">重启</button>\
|
||||
<button class="btn btn-default btn-sm" onclick="orPluginOpService(\''+_name+'\',\'reload\',\''+version+'\')">重载配置</button>\
|
||||
</div>';
|
||||
$(".soft-man-con").html(serviceCon);
|
||||
}
|
||||
|
||||
|
||||
function orPluginOpService(a, b, v,request_callback) {
|
||||
|
||||
var c = "name=" + a + "&func=" + b;
|
||||
if(v != ''){
|
||||
c = c + '&version='+v;
|
||||
}
|
||||
|
||||
var d = "";
|
||||
|
||||
switch(b) {
|
||||
case "stop":d = '停止';break;
|
||||
case "start":d = '启动';break;
|
||||
case "restart":d = '重启';break;
|
||||
case "reload":d = '重载';break;
|
||||
}
|
||||
layer.confirm( msgTpl('您真的要{1}{2}{3}服务吗?', [d,a,v]), {icon:3,closeBtn: 2}, function() {
|
||||
httpPost('get_os',{},function(data){
|
||||
var rdata = $.parseJSON(data.data);
|
||||
if (!rdata['auth']){
|
||||
layer.prompt({title: '检查到权限不足,需要输入密码!', formType: 1},function(pwd, index){
|
||||
|
||||
layer.close(index);
|
||||
var data = {'pwd':pwd};
|
||||
c += '&args='+JSON.stringify(data);
|
||||
orPluginOpServiceOp(a,b,c,d,a,v,request_callback);
|
||||
});
|
||||
} else {
|
||||
orPluginOpServiceOp(a,b,c,d,a,v,request_callback);
|
||||
|
||||
}
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
function orPluginOpServiceOp(a,b,c,d,a,v,request_callback){
|
||||
|
||||
var request_path = "/plugins/run";
|
||||
if (request_callback == 'yes'){
|
||||
request_path = "/plugins/callback";
|
||||
}
|
||||
|
||||
var e = layer.msg(msgTpl('正在{1}{2}{3}服务,请稍候...',[d,a,v]), {icon: 16,time: 0});
|
||||
$.post(request_path, c, function(g) {
|
||||
layer.close(e);
|
||||
|
||||
var f = g.data == 'ok' ? msgTpl('{1}{2}服务已{3}',[a,v,d]) : msgTpl('{1}{2}服务{3}失败!',[a,v,d]);
|
||||
layer.msg(f, {icon: g.data == 'ok' ? 1 : 2});
|
||||
|
||||
if( b != "reload" && g.data == 'ok' ) {
|
||||
if ( b == 'start' ) {
|
||||
orPluginSetService(a, true, v);
|
||||
} else if ( b == 'stop' ){
|
||||
orPluginSetService(a, false, v);
|
||||
}
|
||||
}
|
||||
|
||||
if( g.status && g.data != 'ok' ) {
|
||||
layer.msg(g.data, {icon: 2,time: 10000,shade: 0.3});
|
||||
}
|
||||
|
||||
},'json').error(function() {
|
||||
layer.close(e);
|
||||
layer.msg('操作异常!', {icon: 2});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// 定时器变量
|
||||
var httpdStatusTimer = null;
|
||||
|
||||
//查看Apache负载状态
|
||||
function getHttpdStatus() {
|
||||
$.post('/plugins/run', {name:'apache', func:'run_info'}, function(data) {
|
||||
try {
|
||||
var rdata = $.parseJSON(data.data);
|
||||
|
||||
console.log(rdata);
|
||||
if ('status' in rdata && !rdata.status){
|
||||
showMsg(rdata.msg, function(){}, null,3000);
|
||||
return;
|
||||
}
|
||||
|
||||
var con = "<div><table class='table table-hover table-bordered'>\
|
||||
<tr><th>服务器版本(ServerVersion)</th><td>" + (rdata.ServerVersion || '-') + "</td></tr>\
|
||||
<tr><th>服务器MPM(ServerMPM)</th><td>" + (rdata.ServerMPM || '-') + "</td></tr>\
|
||||
<tr><th>服务器构建时间(Server Built)</th><td>" + (rdata['Server Built'] || '-') + "</td></tr>\
|
||||
<tr><th>当前时间(CurrentTime)</th><td>" + (rdata.CurrentTime || '-') + "</td></tr>\
|
||||
<tr><th>重启时间(RestartTime)</th><td>" + (rdata.RestartTime || '-') + "</td></tr>\
|
||||
<tr><th>服务器运行时间(ServerUptime)</th><td>" + (rdata.ServerUptime || '-') + "</td></tr>\
|
||||
<tr><th>服务器运行秒数(ServerUptimeSeconds)</th><td>" + (rdata.ServerUptimeSeconds || '-') + "</td></tr>\
|
||||
<tr><th>1分钟负载(Load1)</th><td>" + (rdata.Load1 || '-') + "</td></tr>\
|
||||
<tr><th>5分钟负载(Load5)</th><td>" + (rdata.Load5 || '-') + "</td></tr>\
|
||||
<tr><th>15分钟负载(Load15)</th><td>" + (rdata.Load15 || '-') + "</td></tr>\
|
||||
<tr><th>总访问次数(Total Accesses)</th><td>" + (rdata['Total Accesses'] || '-') + "</td></tr>\
|
||||
<tr><th>总流量(Total kBytes)</th><td>" + (rdata['Total kBytes'] || '-') + " KB</td></tr>\
|
||||
<tr><th>总请求时间(Total Duration)</th><td>" + (rdata['Total Duration'] || '-') + "</td></tr>\
|
||||
<tr><th>CPU用户时间(CPUUser)</th><td>" + (rdata.CPUUser || '-') + "</td></tr>\
|
||||
<tr><th>CPU系统时间(CPUSystem)</th><td>" + (rdata.CPUSystem || '-') + "</td></tr>\
|
||||
<tr><th>CPU负载(CPULoad)</th><td>" + (rdata.CPULoad || '-') + "</td></tr>\
|
||||
<tr><th>每秒请求数(ReqPerSec)</th><td>" + (rdata.ReqPerSec || '-') + "</td></tr>\
|
||||
<tr><th>每秒流量(BytesPerSec)</th><td>" + (rdata.BytesPerSec || '-') + "</td></tr>\
|
||||
<tr><th>每请求流量(BytesPerReq)</th><td>" + (rdata.BytesPerReq || '-') + "</td></tr>\
|
||||
<tr><th>每请求时间(DurationPerReq)</th><td>" + (rdata.DurationPerReq || '-') + "</td></tr>\
|
||||
<tr><th>活动工作进程(BusyWorkers)</th><td>" + (rdata.BusyWorkers || '-') + "</td></tr>\
|
||||
<tr><th>优雅关闭进程(GracefulWorkers)</th><td>" + (rdata.GracefulWorkers || '-') + "</td></tr>\
|
||||
<tr><th>空闲工作进程(IdleWorkers)</th><td>" + (rdata.IdleWorkers || '-') + "</td></tr>\
|
||||
<tr><th>进程数(Processes)</th><td>" + (rdata.Processes || '-') + "</td></tr>\
|
||||
<tr><th>总连接数(ConnsTotal)</th><td>" + (rdata.ConnsTotal || '-') + "</td></tr>\
|
||||
</table></div>";
|
||||
$(".soft-man-con").html(con);
|
||||
}catch(err){
|
||||
showMsg(data.data, function(){}, null,3000);
|
||||
}
|
||||
},'json');
|
||||
}
|
||||
|
||||
// 启动自动刷新
|
||||
function startHttpdStatusAutoRefresh() {
|
||||
// 先清除现有的定时器
|
||||
if (httpdStatusTimer) {
|
||||
clearInterval(httpdStatusTimer);
|
||||
}
|
||||
|
||||
// 立即执行一次
|
||||
getHttpdStatus();
|
||||
|
||||
// 设置定时器,每5秒刷新一次
|
||||
httpdStatusTimer = setInterval(getHttpdStatus, 5000);
|
||||
}
|
||||
|
||||
// 停止自动刷新
|
||||
function stopHttpdStatusAutoRefresh() {
|
||||
if (httpdStatusTimer) {
|
||||
clearInterval(httpdStatusTimer);
|
||||
httpdStatusTimer = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function setOpCfg(){
|
||||
httpPost('get_cfg', {}, function(data){
|
||||
var rdata = $.parseJSON(data.data);
|
||||
var rdata = rdata.data;
|
||||
// console.log(rdata);
|
||||
|
||||
var mlist = '';
|
||||
for (var i = 0; i < rdata.length; i++) {
|
||||
var w = '70'
|
||||
var ibody = '<input style="width: ' + w + 'px;" class="bt-input-text mr5" name="' + rdata[i].name + '" value="' + rdata[i].value + '" type="text" >';
|
||||
switch (rdata[i].type) {
|
||||
case 0:
|
||||
var selected_1 = (rdata[i].value == 1) ? 'selected' : '';
|
||||
var selected_0 = (rdata[i].value == 0) ? 'selected' : '';
|
||||
ibody = '<select class="bt-input-text mr5" name="' + rdata[i].name + '" style="width: ' + w + 'px;">\
|
||||
<option value="1" ' + selected_1 + '>开启</option>\
|
||||
<option value="0" ' + selected_0 + '>关闭</option>\
|
||||
</select>';
|
||||
break;
|
||||
case 1:
|
||||
var selected_1 = (rdata[i].value == 'on') ? 'selected' : '';
|
||||
var selected_0 = (rdata[i].value == 'off') ? 'selected' : '';
|
||||
ibody = '<select class="bt-input-text mr5" name="' + rdata[i].name + '" style="width: ' + w + 'px;">\
|
||||
<option value="on" ' + selected_1 + '>开启</option>\
|
||||
<option value="off" ' + selected_0 + '>关闭</option>\
|
||||
</select>';
|
||||
break;
|
||||
}
|
||||
mlist += '<p style="margin-top:15px;"><span>' + rdata[i].name + '</span>' + ibody + "<b class='unit c9'>"+rdata[i].unit+"</b>" +', <font class="c9">' + rdata[i].ps + '</font></p>';
|
||||
}
|
||||
var con = '<style>.conf_p p{margin-bottom: 2px}</style><div class="conf_p" style="margin-bottom:0">\
|
||||
' + mlist + '\
|
||||
<div style="margin-top:10px; padding-right:15px" class="text-right">\
|
||||
<button class="btn btn-success btn-sm mr5" onclick="setOpCfg()">刷新</button>\
|
||||
<button class="btn btn-success btn-sm" onclick="submitConf()">保存</button>\
|
||||
</div>\
|
||||
</div>'
|
||||
$(".soft-man-con").html(con);
|
||||
});
|
||||
}
|
||||
|
||||
function submitConf() {
|
||||
var data = {};
|
||||
|
||||
// 收集所有配置参数
|
||||
$("input[name]").each(function() {
|
||||
data[$(this).attr('name')] = $(this).val();
|
||||
});
|
||||
|
||||
$("select[name]").each(function() {
|
||||
data[$(this).attr('name')] = $(this).val() || 'on';
|
||||
});
|
||||
|
||||
// console.log(data);
|
||||
httpPost('set_cfg', data, function(rdata){
|
||||
var rdata = $.parseJSON(rdata.data);
|
||||
// console.log(rdata);
|
||||
layer.msg(rdata.msg, { icon: rdata.status ? 1 : 2 });
|
||||
});
|
||||
}
|
||||
|
||||
function otherFunc(){
|
||||
var con = '<p class="conf_p" style="text-align:center;">\
|
||||
<button class="btn btn-default btn-sm" onclick="cronAddCheck()">添加检查任务</button> \
|
||||
<button class="btn btn-default btn-sm" onclick="cronDelCheck()">删除检查任务</button>\
|
||||
</p>';
|
||||
$(".soft-man-con").html(con);
|
||||
}
|
||||
|
||||
function cronAddCheck(){
|
||||
httpPost('cron_add_check', {}, function(data){
|
||||
var rdata = $.parseJSON(data.data);
|
||||
layer.msg(rdata.msg, { icon: rdata.status ? 1 : 2 });
|
||||
});
|
||||
}
|
||||
|
||||
function cronDelCheck(){
|
||||
httpPost('cron_del_check', {}, function(data){
|
||||
var rdata = $.parseJSON(data.data);
|
||||
layer.msg(rdata.msg, { icon: rdata.status ? 1 : 2 });
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,124 @@
|
||||
# coding:utf-8
|
||||
|
||||
import sys
|
||||
import io
|
||||
import os
|
||||
import time
|
||||
import json
|
||||
|
||||
web_dir = os.getcwd() + "/web"
|
||||
if os.path.exists(web_dir):
|
||||
sys.path.append(web_dir)
|
||||
os.chdir(web_dir)
|
||||
|
||||
import core.mw as mw
|
||||
from utils.crontab import crontab as MwCrontab
|
||||
|
||||
|
||||
app_debug = False
|
||||
if mw.isAppleSystem():
|
||||
app_debug = True
|
||||
|
||||
|
||||
def getPluginName():
|
||||
return 'apache'
|
||||
|
||||
|
||||
def getPluginDir():
|
||||
return mw.getPluginDir() + '/' + getPluginName()
|
||||
|
||||
|
||||
def getServerDir():
|
||||
return mw.getServerDir() + '/' + getPluginName()
|
||||
|
||||
|
||||
def getTaskConf():
|
||||
conf = getServerDir() + "/task_config.json"
|
||||
return conf
|
||||
|
||||
|
||||
def getConfigData():
|
||||
conf = getTaskConf()
|
||||
if os.path.exists(conf):
|
||||
return json.loads(mw.readFile(getTaskConf()))
|
||||
return {
|
||||
"task_id": -1,
|
||||
"period": "minute-n",
|
||||
"where1": "3",
|
||||
"hour": "0",
|
||||
"minute": "0",
|
||||
}
|
||||
|
||||
|
||||
def createBgTask():
|
||||
removeBgTask()
|
||||
createBgTaskByName(getPluginName())
|
||||
|
||||
|
||||
def createBgTaskByName(name):
|
||||
args = getConfigData()
|
||||
_name = "[apache]检查任务"
|
||||
res = mw.M("crontab").field("id, name").where("name=?", (_name,)).find()
|
||||
if res:
|
||||
return True
|
||||
|
||||
if "task_id" in args and args["task_id"] > 0:
|
||||
res = mw.M("crontab").field("id, name").where(
|
||||
"id=?", (args["task_id"],)).find()
|
||||
if res and res["id"] == args["task_id"]:
|
||||
print("计划任务已经存在!")
|
||||
return True
|
||||
|
||||
mw_dir = mw.getPanelDir()
|
||||
cmd = '''
|
||||
mw_dir=%s
|
||||
rname=%s
|
||||
plugin_path=%s
|
||||
script_path=%s
|
||||
''' % (mw_dir, name, getServerDir(), getPluginDir())
|
||||
cmd += 'echo "bash $script_path/check.sh"' + "\n"
|
||||
cmd += 'cd $mw_dir && bash $script_path/check.sh' + "\n"
|
||||
|
||||
params = {
|
||||
'name': _name,
|
||||
'type': args['period'],
|
||||
'week': "",
|
||||
'where1': args['where1'],
|
||||
'hour': args['hour'],
|
||||
'minute': args['minute'],
|
||||
'save': "",
|
||||
'backup_to': "",
|
||||
'stype': "toShell",
|
||||
'sname': '',
|
||||
'sbody': cmd,
|
||||
'url_address': '',
|
||||
}
|
||||
|
||||
task_id = MwCrontab.instance().add(params)
|
||||
if task_id > 0:
|
||||
args["task_id"] = task_id
|
||||
args["name"] = name
|
||||
mw.writeFile(getTaskConf(), json.dumps(args))
|
||||
|
||||
|
||||
def removeBgTask():
|
||||
cfg = getConfigData()
|
||||
if "task_id" in cfg and cfg["task_id"] > 0:
|
||||
res = mw.M("crontab").field("id, name").where(
|
||||
"id=?", (cfg["task_id"],)).find()
|
||||
if res and res["id"] == cfg["task_id"]:
|
||||
data = MwCrontab.instance().delete(cfg["task_id"])
|
||||
if data["status"]:
|
||||
cfg["task_id"] = -1
|
||||
mw.writeFile(getTaskConf(), json.dumps(cfg))
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
if len(sys.argv) > 1:
|
||||
action = sys.argv[1]
|
||||
if action == "remove":
|
||||
removeBgTask()
|
||||
elif action == "add":
|
||||
createBgTask()
|
||||
@@ -0,0 +1,172 @@
|
||||
#!/bin/bash
|
||||
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin:/opt/homebrew/bin
|
||||
export PATH
|
||||
|
||||
# cd /Users/midoks/Desktop/mwdev/server/mdserver-web/plugins/apache && bash install.sh install 2.4
|
||||
# cd /www/server/mdserver-web/plugins/apache && bash install.sh install 2.4
|
||||
|
||||
curPath=`pwd`
|
||||
rootPath=$(dirname "$curPath")
|
||||
rootPath=$(dirname "$rootPath")
|
||||
serverPath=$(dirname "$rootPath")
|
||||
|
||||
sysName=`uname`
|
||||
action=$1
|
||||
type=$2
|
||||
|
||||
VERSION=2.4.66
|
||||
apacheDir=${serverPath}/source/apache
|
||||
|
||||
Install_App()
|
||||
{
|
||||
if [ "${action}" == "install" ];then
|
||||
if [ -d $serverPath/apache ];then
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
|
||||
# ----- cpu start ------
|
||||
if [ -z "${cpuCore}" ]; then
|
||||
cpuCore="1"
|
||||
fi
|
||||
|
||||
if [ -f /proc/cpuinfo ];then
|
||||
cpuCore=`cat /proc/cpuinfo | grep "processor" | wc -l`
|
||||
fi
|
||||
|
||||
MEM_INFO=$(free -m|grep Mem|awk '{printf("%.f",($2)/1024)}')
|
||||
if [ "${cpuCore}" != "1" ] && [ "${MEM_INFO}" != "0" ];then
|
||||
if [ "${cpuCore}" -gt "${MEM_INFO}" ];then
|
||||
cpuCore="${MEM_INFO}"
|
||||
fi
|
||||
else
|
||||
cpuCore="1"
|
||||
fi
|
||||
|
||||
if [ "$cpuCore" -gt "2" ];then
|
||||
cpuCore=`echo "$cpuCore" | awk '{printf("%.f",($1)*0.8)}'`
|
||||
else
|
||||
cpuCore="1"
|
||||
fi
|
||||
# ----- cpu end ------
|
||||
|
||||
mkdir -p ${apacheDir}
|
||||
echo 'install script ...'
|
||||
OPTIONS=''
|
||||
|
||||
# 安装 APR 和 APR-util
|
||||
APR_VERSION=1.7.6
|
||||
APR_UTIL_VERSION=1.6.3
|
||||
|
||||
if [ ! -f ${apacheDir}/apr-${APR_VERSION}.tar.bz2 ];then
|
||||
wget --no-check-certificate -O ${apacheDir}/apr-${APR_VERSION}.tar.bz2 https://downloads.apache.org/apr/apr-${APR_VERSION}.tar.bz2 -T 3
|
||||
fi
|
||||
|
||||
if [ ! -f ${apacheDir}/apr-util-${APR_UTIL_VERSION}.tar.bz2 ];then
|
||||
wget --no-check-certificate -O ${apacheDir}/apr-util-${APR_UTIL_VERSION}.tar.bz2 https://downloads.apache.org/apr/apr-util-${APR_UTIL_VERSION}.tar.bz2 -T 3
|
||||
fi
|
||||
|
||||
# 安装 APR
|
||||
if [ ! -d ${serverPath}/apache/apr ];then
|
||||
cd ${apacheDir} && tar -jxf apr-${APR_VERSION}.tar.bz2
|
||||
cd ${apacheDir}/apr-${APR_VERSION} && ./configure --prefix=${serverPath}/apache/apr
|
||||
make -j${cpuCore} && make install
|
||||
if [ "$?" == "0" ];then
|
||||
# 检查 APR 配置文件
|
||||
APR_CONFIG=$(find ${serverPath}/apache/apr -name "apr-*config" | head -1)
|
||||
if [ -z "$APR_CONFIG" ];then
|
||||
echo "APR installation failed: apr-config not found"
|
||||
exit 1
|
||||
fi
|
||||
echo "APR installed successfully: $APR_CONFIG"
|
||||
else
|
||||
echo "APR configure failed"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
# 安装 APR-util
|
||||
if [ ! -d ${serverPath}/apache/apr-util ];then
|
||||
cd ${apacheDir} && tar -jxf apr-util-${APR_UTIL_VERSION}.tar.bz2
|
||||
cd ${apacheDir}/apr-util-${APR_UTIL_VERSION} && ./configure --prefix=${serverPath}/apache/apr-util --with-apr=${serverPath}/apache/apr
|
||||
make -j${cpuCore} && make install
|
||||
if [ "$?" == "0" ];then
|
||||
# 检查 APR-util 配置文件
|
||||
APU_CONFIG=$(find ${serverPath}/apache/apr-util -name "apu-*config" | head -1)
|
||||
if [ -z "$APU_CONFIG" ];then
|
||||
echo "APR-util installation failed: apu-config not found"
|
||||
find ${serverPath}/apache/apr-util -name "apu-*config"
|
||||
exit 1
|
||||
fi
|
||||
echo "APR-util installed successfully: $APU_CONFIG"
|
||||
else
|
||||
echo "APR-util configure failed"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ ! -f ${apacheDir}/httpd-${VERSION}.tar.bz2 ];then
|
||||
wget --no-check-certificate -O ${apacheDir}/httpd-${VERSION}.tar.bz2 https://downloads.apache.org/httpd/httpd-${VERSION}.tar.bz2 -T 3
|
||||
fi
|
||||
|
||||
if [ ! -d ${apacheDir}/httpd-${VERSION} ];then
|
||||
cd ${apacheDir} && tar -jxf ${apacheDir}/httpd-${VERSION}.tar.bz2
|
||||
fi
|
||||
|
||||
|
||||
# 检查 APR 和 APR-util 可执行文件
|
||||
APR_CONFIG=$(find ${serverPath}/apache/apr -name "apr-*config" | head -1)
|
||||
APU_CONFIG=$(find ${serverPath}/apache/apr-util -name "apu-*config" | head -1)
|
||||
|
||||
if [ -z "$APR_CONFIG" ];then
|
||||
echo "APR config not found"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -z "$APU_CONFIG" ];then
|
||||
echo "APR-util config not found"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
OPTIONS="${OPTIONS} --with-apr=$APR_CONFIG"
|
||||
OPTIONS="${OPTIONS} --with-apr-util=$APU_CONFIG"
|
||||
|
||||
# if [ "$sysName" != "Darwin" ];then
|
||||
# OPTIONS="${OPTIONS} --enable-systemd"
|
||||
# fi
|
||||
# echo "cd ${apacheDir}/httpd-${VERSION} && ./configure --prefix=$serverPath/apache $OPTIONS"
|
||||
cd ${apacheDir}/httpd-${VERSION} && ./configure \
|
||||
--prefix=$serverPath/apache/httpd \
|
||||
$OPTIONS
|
||||
|
||||
make -j${cpuCore} && make install && make clean
|
||||
|
||||
|
||||
if [ -d ${apacheDir}/apr-${APR_VERSION} ];then
|
||||
rm -rf ${apacheDir}/apr-${APR_VERSION}
|
||||
fi
|
||||
|
||||
if [ -d ${apacheDir}/apr-util-${APR_UTIL_VERSION} ];then
|
||||
rm -rf ${apacheDir}/apr-util-${APR_UTIL_VERSION}
|
||||
fi
|
||||
|
||||
if [ -d ${apacheDir}/httpd-${APR_UTIL_VERSION} ];then
|
||||
rm -rf ${apacheDir}/httpd-${APR_UTIL_VERSION}
|
||||
fi
|
||||
|
||||
echo 'installation of apache completed'
|
||||
}
|
||||
|
||||
Uninstall_App()
|
||||
{
|
||||
echo 'uninstalling apache completed'
|
||||
}
|
||||
|
||||
action=$1
|
||||
if [ "${1}" == "install" ];then
|
||||
Install_App
|
||||
elif [ "${1}" == "upgrade" ];then
|
||||
Install_App
|
||||
else
|
||||
Uninstall_App
|
||||
fi
|
||||
Executable
+35
@@ -0,0 +1,35 @@
|
||||
#!/bin/bash
|
||||
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin:/opt/homebrew/bin
|
||||
export PATH
|
||||
|
||||
# OpenResty服务名称
|
||||
service_name="caddy"
|
||||
|
||||
# 检查OpenResty是否正在运行
|
||||
if systemctl is-active --quiet "$service_name"; then
|
||||
# 检查是否存在僵尸进程
|
||||
zombie_processes=$(ps -ef | grep -i caddy | grep -v grep | awk '{print $2}' | xargs ps -o state= -p 2>/dev/null | grep -c Z)
|
||||
if [ "$zombie_processes" -gt 0 ]; then
|
||||
echo "kill caddy 僵尸进程"
|
||||
ps -ef|grep caddy| grep -v grep| awk '{print $2}' | xargs kill -9
|
||||
echo "检测到OpenResty僵尸进程,正在重启服务..."
|
||||
systemctl restart "$service_name"
|
||||
echo "服务已重启"
|
||||
else
|
||||
echo "OpenResty运行正常"
|
||||
fi
|
||||
else
|
||||
echo "kill caddy"
|
||||
ps -ef|grep caddy| grep -v grep| awk '{print $2}' | xargs kill -9
|
||||
echo "caddy未运行,正在启动服务..."
|
||||
systemctl start "$service_name"
|
||||
echo "服务已启动"
|
||||
fi
|
||||
|
||||
NGINX_IDS=`ps -ef|grep caddy | grep -v grep| awk '{print $2}'`
|
||||
if [ "$NGINX_IDS" == "" ];then
|
||||
ps -ef|grep caddy| grep -v grep| awk '{print $2}' | xargs kill -9
|
||||
systemctl start "$service_name"
|
||||
echo "caddy未运行,正在启动服务..."
|
||||
fi
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
:8080 {
|
||||
# Set this path to your site's directory.
|
||||
root * /tmp
|
||||
|
||||
# Enable the static file server.
|
||||
file_server
|
||||
|
||||
# Another common task is to set up a reverse proxy:
|
||||
# reverse_proxy localhost:8080
|
||||
|
||||
# Or serve a PHP site through php-fpm:
|
||||
# php_fastcgi localhost:9000
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 3.5 KiB |
Executable
+24
@@ -0,0 +1,24 @@
|
||||
<div class="bt-form">
|
||||
<!-- <div class='plugin_version'></div> -->
|
||||
<div class="bt-w-main">
|
||||
<div class="bt-w-menu">
|
||||
<p class="bgw" onclick="orPluginService('caddy',$('.plugin_version').attr('version'));">服务</p>
|
||||
<p onclick="pluginInitD('caddy', $('.plugin_version').attr('version'));">自启动</p>
|
||||
<p onclick="pluginConfig('caddy');">配置修改</p>
|
||||
<p onclick="getOpStatus();">负载状态</p>
|
||||
<p onclick="setOpCfg();">性能调整</p>
|
||||
<p onclick="pluginLogs('caddy');">错误日志</p>
|
||||
<p onclick="otherFunc();">维护功能</p>
|
||||
</div>
|
||||
<div class="bt-w-con pd15">
|
||||
<div class="soft-man-con"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
$.getScript( "/plugins/file?name=caddy&f=js/caddy.js", function(){
|
||||
orPluginService('caddy');
|
||||
});
|
||||
</script>
|
||||
Executable
+445
@@ -0,0 +1,445 @@
|
||||
# coding:utf-8
|
||||
|
||||
import sys
|
||||
import io
|
||||
import os
|
||||
import time
|
||||
import threading
|
||||
import subprocess
|
||||
import re
|
||||
|
||||
|
||||
web_dir = os.getcwd() + "/web"
|
||||
if os.path.exists(web_dir):
|
||||
sys.path.append(web_dir)
|
||||
os.chdir(web_dir)
|
||||
|
||||
import core.mw as mw
|
||||
|
||||
app_debug = False
|
||||
if mw.isAppleSystem():
|
||||
app_debug = True
|
||||
|
||||
|
||||
def getPluginName():
|
||||
return 'caddy'
|
||||
|
||||
|
||||
def getPluginDir():
|
||||
return mw.getPluginDir() + '/' + getPluginName()
|
||||
|
||||
|
||||
def getServerDir():
|
||||
return mw.getServerDir() + '/' + getPluginName()
|
||||
|
||||
|
||||
def getInitDFile():
|
||||
current_os = mw.getOs()
|
||||
if current_os == 'darwin':
|
||||
return '/tmp/' + getPluginName()
|
||||
|
||||
if current_os.startswith('freebsd'):
|
||||
return '/etc/rc.d/' + getPluginName()
|
||||
|
||||
return '/etc/init.d/' + getPluginName()
|
||||
|
||||
|
||||
def getArgs():
|
||||
args = sys.argv[2:]
|
||||
# print(args)
|
||||
tmp = {}
|
||||
args_len = len(args)
|
||||
|
||||
if args_len == 1:
|
||||
t = args[0].strip('{').strip('}')
|
||||
t = t.split(':',2)
|
||||
tmp[t[0]] = t[1]
|
||||
elif args_len > 1:
|
||||
for i in range(len(args)):
|
||||
t = args[i].split(':',2)
|
||||
tmp[t[0]] = t[1]
|
||||
# print(tmp)
|
||||
return tmp
|
||||
|
||||
|
||||
def checkArgs(data, ck=[]):
|
||||
for i in range(len(ck)):
|
||||
if not ck[i] in data:
|
||||
return (False, mw.returnJson(False, '参数:(' + ck[i] + ')没有!'))
|
||||
return (True, mw.returnJson(True, 'ok'))
|
||||
|
||||
|
||||
def getOs():
|
||||
data = {}
|
||||
data['os'] = mw.getOs()
|
||||
data['auth'] = True
|
||||
return mw.getJson(data)
|
||||
|
||||
def getConf():
|
||||
path = getServerDir() + "/Caddyfile"
|
||||
return path
|
||||
|
||||
|
||||
def getConfTpl():
|
||||
path = getPluginDir() + '/conf/Caddyfile'
|
||||
return path
|
||||
|
||||
|
||||
def getInitDTpl():
|
||||
path = getPluginDir() + "/init.d/caddy.tpl"
|
||||
return path
|
||||
|
||||
def initDreplace():
|
||||
file_tpl = getInitDTpl()
|
||||
service_path = mw.getServerDir()
|
||||
initD_path = getServerDir() + '/init.d'
|
||||
|
||||
# init.d
|
||||
file_bin = initD_path + '/' + getPluginName()
|
||||
|
||||
if not os.path.exists(initD_path):
|
||||
os.mkdir(initD_path)
|
||||
|
||||
# initd replace
|
||||
content = mw.readFile(file_tpl)
|
||||
content = content.replace('{$SERVER_PATH}', service_path)
|
||||
mw.writeFile(file_bin, content)
|
||||
mw.execShell('chmod +x ' + file_bin)
|
||||
|
||||
caddy_file = getConf()
|
||||
if not os.path.exists(caddy_file):
|
||||
caddy_file_tpl = getConfTpl()
|
||||
content = mw.readFile(systemServiceTpl)
|
||||
content = content.replace('{$SERVER_PATH}', service_path)
|
||||
mw.writeFile(caddy_file, content)
|
||||
|
||||
# systemd
|
||||
# /usr/lib/systemd/system
|
||||
systemDir = mw.systemdCfgDir()
|
||||
systemService = systemDir + '/caddy.service'
|
||||
if os.path.exists(systemDir) and not os.path.exists(systemService):
|
||||
systemServiceTpl = getPluginDir() + '/init.d/caddy.service.tpl'
|
||||
se_content = mw.readFile(systemServiceTpl)
|
||||
se_content = se_content.replace('{$SERVER_PATH}', service_path)
|
||||
mw.writeFile(systemService, se_content)
|
||||
mw.execShell('systemctl daemon-reload')
|
||||
|
||||
return file_bin
|
||||
|
||||
|
||||
def status():
|
||||
cmd = "ps -ef|grep 'caddy run' |grep -v grep | grep -v python | awk '{print $2}'"
|
||||
data = mw.execShell(cmd)
|
||||
if data[0] == '':
|
||||
return 'stop'
|
||||
return 'start'
|
||||
|
||||
|
||||
def caddyOp(method):
|
||||
file = initDreplace()
|
||||
|
||||
current_os = mw.getOs()
|
||||
if current_os == "darwin":
|
||||
data = mw.execShell(file + ' ' + method)
|
||||
if data[1] == '':
|
||||
return 'ok'
|
||||
return data[1]
|
||||
|
||||
if current_os.startswith("freebsd"):
|
||||
data = mw.execShell('service caddy ' + method)
|
||||
if data[1] == '':
|
||||
return 'ok'
|
||||
return data[1]
|
||||
|
||||
data = mw.execShell('systemctl ' + method + ' caddy')
|
||||
if data[1] == '':
|
||||
return 'ok'
|
||||
return data[1]
|
||||
|
||||
def start():
|
||||
return caddyOp('start')
|
||||
|
||||
|
||||
def stop():
|
||||
r = caddyOp('stop')
|
||||
return r
|
||||
|
||||
|
||||
def restart():
|
||||
return restyOp_restart()
|
||||
|
||||
|
||||
def reload():
|
||||
confReplace()
|
||||
return caddyOp('reload')
|
||||
|
||||
|
||||
def initdStatus():
|
||||
current_os = mw.getOs()
|
||||
if current_os == 'darwin':
|
||||
return "Apple Computer does not support"
|
||||
|
||||
if current_os.startswith('freebsd'):
|
||||
initd_bin = getInitDFile()
|
||||
if os.path.exists(initd_bin):
|
||||
return 'ok'
|
||||
|
||||
shell_cmd = 'systemctl status caddy | grep loaded | grep "enabled;"'
|
||||
data = mw.execShell(shell_cmd)
|
||||
if data[0] == '':
|
||||
return 'fail'
|
||||
return 'ok'
|
||||
|
||||
|
||||
def initdInstall():
|
||||
current_os = mw.getOs()
|
||||
if current_os == 'darwin':
|
||||
return "Apple Computer does not support"
|
||||
|
||||
# freebsd initd install
|
||||
if current_os.startswith('freebsd'):
|
||||
import shutil
|
||||
source_bin = initDreplace()
|
||||
initd_bin = getInitDFile()
|
||||
shutil.copyfile(source_bin, initd_bin)
|
||||
mw.execShell('chmod +x ' + initd_bin)
|
||||
mw.execShell('sysrc ' + getPluginName() + '_enable="YES"')
|
||||
return 'ok'
|
||||
|
||||
mw.execShell('systemctl enable caddy')
|
||||
return 'ok'
|
||||
|
||||
|
||||
def initdUinstall():
|
||||
current_os = mw.getOs()
|
||||
if current_os == 'darwin':
|
||||
return "Apple Computer does not support"
|
||||
|
||||
if current_os.startswith('freebsd'):
|
||||
initd_bin = getInitDFile()
|
||||
os.remove(initd_bin)
|
||||
mw.execShell('sysrc ' + getPluginName() + '_enable="NO"')
|
||||
return 'ok'
|
||||
|
||||
mw.execShell('systemctl disable caddy')
|
||||
return 'ok'
|
||||
|
||||
|
||||
def runInfo():
|
||||
op_status = status()
|
||||
if op_status == 'stop':
|
||||
return mw.returnJson(False, "未启动!")
|
||||
|
||||
|
||||
def errorLogPath():
|
||||
return getServerDir() + '/nginx/logs/error.log'
|
||||
|
||||
|
||||
def getCfg():
|
||||
cfg = getConf()
|
||||
content = mw.readFile(cfg)
|
||||
|
||||
unitrep = "[kmgKMG]"
|
||||
cfg_args = [
|
||||
{"name": "worker_processes", "ps": "处理进程,auto表示自动,数字表示进程数", 'type': 2},
|
||||
{"name": "worker_connections", "ps": "最大并发链接数", 'type': 2},
|
||||
{"name": "keepalive_timeout", "ps": "连接超时时间", 'type': 2},
|
||||
{"name": "zstd", "ps": "是否开启zstd压缩传输", 'type': 1},
|
||||
{"name": "brotli", "ps": "是否开启brotli压缩传输", 'type': 1},
|
||||
{"name": "gzip", "ps": "是否开启gzip压缩传输", 'type': 1},
|
||||
{"name": "gzip_min_length", "ps": "最小压缩文件", 'type': 2},
|
||||
{"name": "gzip_comp_level", "ps": "压缩率", 'type': 2},
|
||||
{"name": "client_max_body_size", "ps": "最大上传文件", 'type': 2},
|
||||
{"name": "server_names_hash_bucket_size",
|
||||
"ps": "服务器名字的hash表大小", 'type': 2},
|
||||
{"name": "client_header_buffer_size", "ps": "客户端请求头buffer大小", 'type': 2},
|
||||
]
|
||||
|
||||
# {"name": "client_body_buffer_size", "ps": "请求主体缓冲区"}
|
||||
rdata = []
|
||||
for i in cfg_args:
|
||||
rep = r"(%s)\s+(\w+)" % i["name"]
|
||||
k = re.search(rep, content)
|
||||
if not k:
|
||||
return mw.returnJson(False, "获取 key {} 失败".format(k))
|
||||
k = k.group(1)
|
||||
v = re.search(rep, content)
|
||||
if not v:
|
||||
return mw.returnJson(False, "获取 value {} 失败".format(v))
|
||||
v = v.group(2)
|
||||
|
||||
if re.search(unitrep, v):
|
||||
u = str.upper(v[-1])
|
||||
v = v[:-1]
|
||||
if len(u) == 1:
|
||||
psstr = u + "B," + i["ps"]
|
||||
else:
|
||||
psstr = u + "," + i["ps"]
|
||||
else:
|
||||
u = ""
|
||||
|
||||
kv = {"name": k, "value": v, "unit": u,
|
||||
"ps": i["ps"], "type": i["type"]}
|
||||
rdata.append(kv)
|
||||
|
||||
return mw.returnJson(True, "ok", rdata)
|
||||
|
||||
def replaceChar(value, index, new_char):
|
||||
return value[:index] + new_char + value[index+1:]
|
||||
|
||||
def makeWorkerCpuAffinity(val):
|
||||
if val == "auto":
|
||||
return "auto"
|
||||
|
||||
if mw.isNumber(val):
|
||||
core_num = int(val)
|
||||
default_core_str = "0"*core_num
|
||||
core_num_arr = []
|
||||
for x in range(core_num):
|
||||
t = replaceChar(default_core_str, x , "1")
|
||||
core_num_arr.append(t)
|
||||
return " ".join(core_num_arr)
|
||||
|
||||
return 'auto'
|
||||
|
||||
def setCfg():
|
||||
|
||||
args = getArgs()
|
||||
data = checkArgs(args, [
|
||||
'worker_processes', 'worker_connections', 'keepalive_timeout','zstd','brotli',
|
||||
'gzip', 'gzip_min_length', 'gzip_comp_level', 'client_max_body_size',
|
||||
'server_names_hash_bucket_size', 'client_header_buffer_size'
|
||||
])
|
||||
if not data[0]:
|
||||
return data[1]
|
||||
|
||||
cfg = getConf()
|
||||
mw.backFile(cfg)
|
||||
content = mw.readFile(cfg)
|
||||
|
||||
unitrep = "[kmgKMG]"
|
||||
cfg_args = [
|
||||
{"name": "worker_processes", "ps": "处理进程,auto表示自动,数字表示进程数", 'type': 2},
|
||||
{"name": "worker_connections", "ps": "最大并发链接数", 'type': 2},
|
||||
{"name": "keepalive_timeout", "ps": "连接超时时间", 'type': 2},
|
||||
{"name": "zstd", "ps": "是否开启zstd压缩传输", 'type': 1},
|
||||
{"name": "brotli", "ps": "是否开启brotli压缩传输", 'type': 1},
|
||||
{"name": "gzip", "ps": "是否开启压缩传输", 'type': 1},
|
||||
{"name": "gzip_min_length", "ps": "最小压缩文件", 'type': 2},
|
||||
{"name": "gzip_comp_level", "ps": "压缩率", 'type': 2},
|
||||
{"name": "client_max_body_size", "ps": "最大上传文件", 'type': 2},
|
||||
{"name": "server_names_hash_bucket_size",
|
||||
"ps": "服务器名字的hash表大小", 'type': 2},
|
||||
{"name": "client_header_buffer_size", "ps": "客户端请求头buffer大小", 'type': 2},
|
||||
]
|
||||
|
||||
# print(args)
|
||||
for k, v in args.items():
|
||||
# print(k, v)
|
||||
rep = r"%s\s+[^kKmMgG\;\n]+" % k
|
||||
if k == "worker_processes" or k == "gzip":
|
||||
if not re.search(r"auto|on|off|\d+", v):
|
||||
return mw.returnJson(False, '参数值错误')
|
||||
elif k == "zstd" or k == "brotli":
|
||||
if not re.search(r"auto|on|off|\d+", v):
|
||||
return mw.returnJson(False, '参数值错误')
|
||||
else:
|
||||
if not re.search(r"\d+", v):
|
||||
return mw.returnJson(False, '参数值错误,请输入数字整数')
|
||||
|
||||
if k == "worker_processes" :
|
||||
k_wca = "worker_cpu_affinity"
|
||||
rep_wca = r"%s\s+[^\;\n]+" % k_wca
|
||||
v_wca = makeWorkerCpuAffinity(v)
|
||||
newconf = "%s %s" % (k_wca, v_wca)
|
||||
content = re.sub(rep_wca, newconf, content)
|
||||
|
||||
|
||||
if re.search(rep, content):
|
||||
newconf = "%s %s" % (k, v)
|
||||
content = re.sub(rep, newconf, content)
|
||||
elif re.search(rep, content):
|
||||
newconf = "%s %s" % (k, v)
|
||||
content = re.sub(rep, newconf, content)
|
||||
|
||||
mw.writeFile(cfg, content)
|
||||
isError = mw.checkWebConfig()
|
||||
if (isError != True):
|
||||
mw.restoreFile(cfg)
|
||||
return mw.returnJson(False, 'ERROR: 配置出错<br><a style="color:red;">' + isError.replace("\n", '<br>') + '</a>')
|
||||
|
||||
mw.restartWeb()
|
||||
return mw.returnJson(True, '设置成功')
|
||||
|
||||
|
||||
def cronAddCheck():
|
||||
try:
|
||||
import tool_task
|
||||
tool_task.createBgTask()
|
||||
return mw.returnJson(True, '添加检查任务成功')
|
||||
except Exception as e:
|
||||
return mw.returnJson(False, '添加检查任务失败:'+str(e))
|
||||
|
||||
def cronDelCheck():
|
||||
try:
|
||||
import tool_task
|
||||
tool_task.removeBgTask()
|
||||
return mw.returnJson(True, '删除检查任务成功')
|
||||
except Exception as e:
|
||||
return mw.returnJson(False, '删除检查任务失败:'+str(e))
|
||||
|
||||
def cronCheck():
|
||||
return 'ok'
|
||||
|
||||
|
||||
def installPreInspection():
|
||||
return 'ok'
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
version = '1.27.1'
|
||||
version_pl = getServerDir() + "/version.pl"
|
||||
if os.path.exists(version_pl):
|
||||
version = mw.readFile(version_pl)
|
||||
|
||||
|
||||
func = sys.argv[1]
|
||||
if func == 'status':
|
||||
print(status())
|
||||
elif func == 'start':
|
||||
print(start())
|
||||
elif func == 'stop':
|
||||
print(stop())
|
||||
elif func == 'restart':
|
||||
print(restart())
|
||||
elif func == 'reload':
|
||||
print(reload())
|
||||
elif func == 'initd_status':
|
||||
print(initdStatus())
|
||||
elif func == 'initd_install':
|
||||
print(initdInstall())
|
||||
elif func == 'initd_uninstall':
|
||||
print(initdUinstall())
|
||||
elif func == 'install_pre_inspection':
|
||||
print(installPreInspection())
|
||||
elif func == 'conf':
|
||||
print(getConf())
|
||||
elif func == 'get_os':
|
||||
print(getOs())
|
||||
elif func == 'run_info':
|
||||
print(runInfo())
|
||||
elif func == 'error_log':
|
||||
print(errorLogPath())
|
||||
elif func == 'get_cfg':
|
||||
print(getCfg())
|
||||
elif func == 'set_cfg':
|
||||
print(setCfg())
|
||||
elif func == 'check':
|
||||
print(cronCheck())
|
||||
elif func == 'cron_add_check':
|
||||
print(cronAddCheck())
|
||||
elif func == 'cron_del_check':
|
||||
print(cronDelCheck())
|
||||
else:
|
||||
print('error')
|
||||
Executable
+18
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"sort": 0,
|
||||
"title":"caddy",
|
||||
"tip":"soft",
|
||||
"name":"caddy",
|
||||
"type":"其他插件",
|
||||
"ps":"一款功能强大、企业级、开源 Web 服务器,具有用 Go 编写的自动 HTTPS",
|
||||
"shell":"install.sh",
|
||||
"install_pre_inspection":true,
|
||||
"checks":"server/caddy",
|
||||
"path":"server/caddy",
|
||||
"author":"caddyserver",
|
||||
"home":"https://caddyserver.com/",
|
||||
"date":"2026-04-11",
|
||||
"pid": "1",
|
||||
"versions": ["2.11"],
|
||||
"updates": ["2.11.2"]
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
# caddy.service
|
||||
#
|
||||
# For using Caddy with a config file.
|
||||
#
|
||||
# Make sure the ExecStart and ExecReload commands are correct
|
||||
# for your installation.
|
||||
#
|
||||
# See https://caddyserver.com/docs/install for instructions.
|
||||
#
|
||||
# WARNING: This service does not use the --resume flag, so if you
|
||||
# use the API to make changes, they will be overwritten by the
|
||||
# Caddyfile next time the service is restarted. If you intend to
|
||||
# use Caddy's API to configure it, add the --resume flag to the
|
||||
# `caddy run` command or use the caddy-api.service file instead.
|
||||
|
||||
[Unit]
|
||||
Description=Caddy
|
||||
Documentation=https://caddyserver.com/docs/
|
||||
After=network.target network-online.target
|
||||
Requires=network-online.target
|
||||
|
||||
[Service]
|
||||
Type=notify
|
||||
User=caddy
|
||||
Group=caddy
|
||||
ExecStart={$SERVER_PATH}/caddy/bin/caddy run --environ --config {$SERVER_PATH}/caddy/Caddyfile
|
||||
ExecReload={$SERVER_PATH}/caddy/bin/caddy reload --config {$SERVER_PATH}/caddy/Caddyfile --force
|
||||
TimeoutStopSec=5s
|
||||
LimitNOFILE=1048576
|
||||
LimitNPROC=512
|
||||
PrivateTmp=true
|
||||
ProtectSystem=full
|
||||
AmbientCapabilities=CAP_NET_BIND_SERVICE
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
@@ -0,0 +1,111 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# /etc/rc.d/init.d/caddy
|
||||
#
|
||||
# Runs the caddy
|
||||
#
|
||||
#
|
||||
# chkconfig: - 85 15
|
||||
#
|
||||
|
||||
### BEGIN INIT INFO
|
||||
# Provides: caddy
|
||||
# Required-Start: $remote_fs $syslog
|
||||
# Required-Stop: $remote_fs $syslog
|
||||
# Should-Start: caddy
|
||||
# Should-Stop: caddy
|
||||
# Default-Start: 2 3 4 5
|
||||
# Default-Stop: 0 1 6
|
||||
# Short-Description: Start caddy at boot time.
|
||||
# Description: Control caddy.
|
||||
### END INIT INFO
|
||||
|
||||
# Source function library.
|
||||
if [ -f /etc/init.d/functions ];then
|
||||
. /etc/init.d/functions
|
||||
fi
|
||||
|
||||
if [ -f /etc/rc.d/init.d/functions ];then
|
||||
. /etc/rc.d/init.d/functions
|
||||
fi
|
||||
|
||||
# Default values
|
||||
export HOME={$HOME_DIR}
|
||||
export USER={$RUN_USER}
|
||||
NAME=caddy
|
||||
CADDY_HOME={$SERVER_PATH}/caddy
|
||||
CADDY_PATH=${CADDY_HOME}/bin/$NAME
|
||||
CADDY_USER={$RUN_USER}
|
||||
SERVICENAME="caddy"
|
||||
LOCKFILE=/tmp/caddy.lock
|
||||
LOGPATH=${CADDY_HOME}/log
|
||||
LOGFILE=${LOGPATH}/caddy.log
|
||||
RETVAL=0
|
||||
|
||||
if [ -d $LOGPATH ];then
|
||||
mkdir -p $LOGPATH
|
||||
fi
|
||||
|
||||
[ -r /etc/sysconfig/$NAME ] && . /etc/sysconfig/$NAME
|
||||
DAEMON_OPTS="--check $NAME"
|
||||
[ ! -z "$CADDY_USER" ] && DAEMON_OPTS="$DAEMON_OPTS --user=${CADDY_USER}"
|
||||
|
||||
status(){
|
||||
isStart=`ps -ef|grep 'caddy run' |grep -v grep|awk '{print $2}'`
|
||||
if [ "$isStart" == '' ];then
|
||||
echo -e "${SERVICENAME} not running"
|
||||
else
|
||||
echo -e "${SERVICENAME}(pid $(echo $isStart)) already running"
|
||||
fi
|
||||
}
|
||||
|
||||
start() {
|
||||
isStart=`ps -ef | grep 'caddy run' | grep -v grep | awk '{print $2}'`
|
||||
if [ "$isStart" != '' ];then
|
||||
echo "${SERVICENAME}(pid $(echo $isStart)) already running"
|
||||
return $RETVAL
|
||||
fi
|
||||
|
||||
cd ${CADDY_HOME}
|
||||
echo -e "starting ${SERVICENAME}: \c"
|
||||
${CADDY_PATH} run --environ --config ${CADDY_HOME}/Caddyfile > ${LOGFILE} 2>&1 &
|
||||
RETVAL=$?
|
||||
[ $RETVAL = 0 ] && touch ${LOCKFILE} && echo -e "\033[32mdone\033[0m"
|
||||
return $RETVAL
|
||||
}
|
||||
|
||||
stop() {
|
||||
pids=`ps -ef | grep 'caddy run' | grep -v grep | awk '{print $2}'`
|
||||
arr=($pids)
|
||||
echo -e "stopping caddy... \c"
|
||||
for p in ${arr[@]}
|
||||
do
|
||||
kill -9 $p
|
||||
done
|
||||
echo -e "\033[32mdone\033[0m"
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
start
|
||||
;;
|
||||
stop)
|
||||
stop
|
||||
;;
|
||||
status)
|
||||
status
|
||||
;;
|
||||
restart)
|
||||
stop
|
||||
start
|
||||
;;
|
||||
reload)
|
||||
stop
|
||||
start
|
||||
;;
|
||||
*)
|
||||
echo "Usage: ${NAME} {start|stop|status|restart}"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
exit $RETVAL
|
||||
Executable
+76
@@ -0,0 +1,76 @@
|
||||
#!/bin/bash
|
||||
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin:/opt/homebrew/bin
|
||||
export PATH
|
||||
|
||||
# cd /Users/midoks/Desktop/mwdev/server/mdserver-web/plugins/caddy && bash install.sh install 1.21.4
|
||||
# cd /www/server/mdserver-web/plugins/caddy && bash install.sh install 1.21.4
|
||||
# cd /www/server/mdserver-web/plugins/caddy && bash install.sh install 1.29.2
|
||||
# cd /www/server/mdserver-web/plugins/caddy && bash install.sh upgrade 1.29.2
|
||||
|
||||
# curl -I -H "Accept-Encoding: br" http://localhost
|
||||
# curl -I -H "Accept-Encoding: zstd" http://localhost
|
||||
# curl --http3 -v https://www.xxx.com
|
||||
|
||||
# cd /www/server/mdserver-web && python3 plugins/caddy/index.py run_info
|
||||
|
||||
curPath=`pwd`
|
||||
rootPath=$(dirname "$curPath")
|
||||
rootPath=$(dirname "$rootPath")
|
||||
serverPath=$(dirname "$rootPath")
|
||||
|
||||
sysName=`uname`
|
||||
action=$1
|
||||
type=$2
|
||||
|
||||
VERSION=$2
|
||||
openrestyDir=${serverPath}/source/caddy
|
||||
|
||||
if id www &> /dev/null ;then
|
||||
echo "www uid is `id -u www`"
|
||||
echo "www shell is `grep "^www:" /etc/passwd |cut -d':' -f7 `"
|
||||
else
|
||||
groupadd www
|
||||
useradd -g www -s /bin/bash www
|
||||
fi
|
||||
|
||||
if [ "${action}" == "upgrade" ];then
|
||||
sh -x $curPath/versions/$2/install.sh $1
|
||||
|
||||
echo "${VERSION}" > $serverPath/caddy/version.pl
|
||||
|
||||
#初始化
|
||||
cd ${rootPath} && python3 ${rootPath}/plugins/caddy/index.py start
|
||||
cd ${rootPath} && python3 ${rootPath}/plugins/caddy/index.py initd_install
|
||||
exit 0
|
||||
fi
|
||||
|
||||
|
||||
if [ "${2}" == "" ];then
|
||||
echo '缺少安装脚本版本...'
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ "${action}" == "uninstall" ];then
|
||||
if [ -f /usr/lib/systemd/system/caddy.service ] || [ -f /lib/systemd/system/caddy.service ];then
|
||||
systemctl stop caddy
|
||||
rm -rf /usr/systemd/system/caddy.service
|
||||
rm -rf /lib/systemd/system/caddy.service
|
||||
systemctl daemon-reload
|
||||
fi
|
||||
|
||||
if [ -f $serverPath/caddy/init.d/caddy ];then
|
||||
$serverPath/caddy/init.d/caddy stop
|
||||
fi
|
||||
|
||||
rm -rf $serverPath/caddy
|
||||
fi
|
||||
|
||||
sh -x $curPath/versions/$2/install.sh $1
|
||||
|
||||
if [ "${action}" == "install" ] && [ -d $serverPath/caddy ];then
|
||||
echo "${VERSION}" > $serverPath/caddy/version.pl
|
||||
|
||||
#初始化
|
||||
cd ${rootPath} && python3 ${rootPath}/plugins/caddy/index.py start
|
||||
cd ${rootPath} && python3 ${rootPath}/plugins/caddy/index.py initd_install
|
||||
fi
|
||||
Executable
+238
@@ -0,0 +1,238 @@
|
||||
function caddyPost(method, args, callback){
|
||||
var loadT = layer.msg('正在获取...', { icon: 16, time: 0, shade: 0.3 });
|
||||
$.post('/plugins/run', {name:'caddy', func:method, args:JSON.stringify(args)}, function(data) {
|
||||
layer.close(loadT);
|
||||
if (!data.status){
|
||||
layer.msg(data.msg,{icon:0,time:2000,shade: [0.3, '#000']});
|
||||
return;
|
||||
}
|
||||
|
||||
if(typeof(callback) == 'function'){
|
||||
callback(data);
|
||||
}
|
||||
},'json');
|
||||
}
|
||||
|
||||
function orPluginService(_name, version){
|
||||
var data = {name:_name, func:'status'}
|
||||
if ( typeof(version) != 'undefined' ){
|
||||
data['version'] = version;
|
||||
} else {
|
||||
version = '';
|
||||
}
|
||||
|
||||
caddyPost('status', data, function(data){
|
||||
if (data.data == 'start'){
|
||||
orPluginSetService(_name, true, version);
|
||||
} else {
|
||||
orPluginSetService(_name, false, version);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function orPluginSetService(_name ,status, version){
|
||||
var serviceCon ='<p class="status">当前状态:<span>'+(status ? '开启' : '关闭' )+
|
||||
'</span><span style="color: '+
|
||||
(status?'#20a53a;':'red;')+
|
||||
' margin-left: 3px;" class="glyphicon ' + (status?'glyphicon glyphicon-play':'glyphicon-pause')+'"></span></p><div class="sfm-opt">\
|
||||
<button class="btn btn-default btn-sm" onclick="orPluginOpService(\''+_name+'\',\''+(status?'stop':'start')+'\',\''+version+'\')">'+(status?'停止':'启动')+'</button>\
|
||||
<button class="btn btn-default btn-sm" onclick="orPluginOpService(\''+_name+'\',\'restart\',\''+version+'\',\'yes\')">重启</button>\
|
||||
<button class="btn btn-default btn-sm" onclick="orPluginOpService(\''+_name+'\',\'reload\',\''+version+'\')">重载配置</button>\
|
||||
</div>';
|
||||
$(".soft-man-con").html(serviceCon);
|
||||
}
|
||||
|
||||
|
||||
function orPluginOpService(a, b, v,request_callback) {
|
||||
|
||||
var c = "name=" + a + "&func=" + b;
|
||||
if(v != ''){
|
||||
c = c + '&version='+v;
|
||||
}
|
||||
|
||||
var d = "";
|
||||
|
||||
switch(b) {
|
||||
case "stop":d = '停止';break;
|
||||
case "start":d = '启动';break;
|
||||
case "restart":d = '重启';break;
|
||||
case "reload":d = '重载';break;
|
||||
}
|
||||
layer.confirm( msgTpl('您真的要{1}{2}{3}服务吗?', [d,a,v]), {icon:3,closeBtn: 2}, function() {
|
||||
caddyPost('get_os',{},function(data){
|
||||
var rdata = $.parseJSON(data.data);
|
||||
if (!rdata['auth']){
|
||||
layer.prompt({title: '检查到权限不足,需要输入密码!', formType: 1},function(pwd, index){
|
||||
|
||||
layer.close(index);
|
||||
var data = {'pwd':pwd};
|
||||
c += '&args='+JSON.stringify(data);
|
||||
orPluginOpServiceOp(a,b,c,d,a,v,request_callback);
|
||||
});
|
||||
} else {
|
||||
orPluginOpServiceOp(a,b,c,d,a,v,request_callback);
|
||||
|
||||
}
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
function orPluginOpServiceOp(a,b,c,d,a,v,request_callback){
|
||||
|
||||
var request_path = "/plugins/run";
|
||||
if (request_callback == 'yes'){
|
||||
request_path = "/plugins/callback";
|
||||
}
|
||||
|
||||
var e = layer.msg(msgTpl('正在{1}{2}{3}服务,请稍候...',[d,a,v]), {icon: 16,time: 0});
|
||||
$.post(request_path, c, function(g) {
|
||||
layer.close(e);
|
||||
|
||||
var f = g.data == 'ok' ? msgTpl('{1}{2}服务已{3}',[a,v,d]) : msgTpl('{1}{2}服务{3}失败!',[a,v,d]);
|
||||
layer.msg(f, {icon: g.data == 'ok' ? 1 : 2});
|
||||
|
||||
if( b != "reload" && g.data == 'ok' ) {
|
||||
if ( b == 'start' ) {
|
||||
orPluginSetService(a, true, v);
|
||||
} else if ( b == 'stop' ){
|
||||
orPluginSetService(a, false, v);
|
||||
}
|
||||
}
|
||||
|
||||
if( g.status && g.data != 'ok' ) {
|
||||
layer.msg(g.data, {icon: 2,time: 10000,shade: 0.3});
|
||||
}
|
||||
|
||||
},'json').error(function() {
|
||||
layer.close(e);
|
||||
layer.msg('操作异常!', {icon: 2});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
//查看Nginx负载状态
|
||||
function getOpStatus() {
|
||||
var loadT = layer.msg('正在处理,请稍后...', { icon: 16, time: 0, shade: 0.3 });
|
||||
$.post('/plugins/run', {name:'openresty', func:'run_info'}, function(data) {
|
||||
layer.close(loadT);
|
||||
try {
|
||||
var rdata = $.parseJSON(data.data);
|
||||
if ('status' in rdata && !rdata.status){
|
||||
showMsg(rdata.msg, function(){}, null,3000);
|
||||
return;
|
||||
}
|
||||
|
||||
var con = "<div><table class='table table-hover table-bordered'>\
|
||||
<tr><th>活动连接(Active connections)</th><td>" + rdata.active + "</td></tr>\
|
||||
<tr><th>总连接次数(accepts)</th><td>" + rdata.accepts + "</td></tr>\
|
||||
<tr><th>总握手次数(handled)</th><td>" + rdata.handled + "</td></tr>\
|
||||
<tr><th>总请求数(requests)</th><td>" + rdata.requests + "</td></tr>\
|
||||
<tr><th>请求数(Reading)</th><td>" + rdata.Reading + "</td></tr>\
|
||||
<tr><th>响应数(Writing)</th><td>" + rdata.Writing + "</td></tr>\
|
||||
<tr><th>驻留进程(Waiting)</th><td>" + rdata.Waiting + "</td></tr>\
|
||||
</table></div>";
|
||||
$(".soft-man-con").html(con);
|
||||
}catch(err){
|
||||
showMsg(data.data, function(){}, null,3000);
|
||||
}
|
||||
},'json');
|
||||
}
|
||||
|
||||
|
||||
function setOpCfg(){
|
||||
caddyPost('get_cfg', {}, function(data){
|
||||
var rdata = $.parseJSON(data.data);
|
||||
var rdata = rdata.data;
|
||||
// console.log(rdata);
|
||||
|
||||
var mlist = '';
|
||||
for (var i = 0; i < rdata.length; i++) {
|
||||
var w = '70'
|
||||
var ibody = '<input style="width: ' + w + 'px;" class="bt-input-text mr5" name="' + rdata[i].name + '" value="' + rdata[i].value + '" type="text" >';
|
||||
switch (rdata[i].type) {
|
||||
case 0:
|
||||
var selected_1 = (rdata[i].value == 1) ? 'selected' : '';
|
||||
var selected_0 = (rdata[i].value == 0) ? 'selected' : '';
|
||||
ibody = '<select class="bt-input-text mr5" name="' + rdata[i].name + '" style="width: ' + w + 'px;">\
|
||||
<option value="1" ' + selected_1 + '>开启</option>\
|
||||
<option value="0" ' + selected_0 + '>关闭</option>\
|
||||
</select>';
|
||||
break;
|
||||
case 1:
|
||||
var selected_1 = (rdata[i].value == 'on') ? 'selected' : '';
|
||||
var selected_0 = (rdata[i].value == 'off') ? 'selected' : '';
|
||||
ibody = '<select class="bt-input-text mr5" name="' + rdata[i].name + '" style="width: ' + w + 'px;">\
|
||||
<option value="on" ' + selected_1 + '>开启</option>\
|
||||
<option value="off" ' + selected_0 + '>关闭</option>\
|
||||
</select>';
|
||||
break;
|
||||
}
|
||||
mlist += '<p style="margin-top:15px;"><span>' + rdata[i].name + '</span>' + ibody + "<b class='unit c9'>"+rdata[i].unit+"</b>" +', <font class="c9">' + rdata[i].ps + '</font></p>';
|
||||
}
|
||||
var con = '<style>.conf_p p{margin-bottom: 2px}</style><div class="conf_p" style="margin-bottom:0">\
|
||||
' + mlist + '\
|
||||
<div style="margin-top:10px; padding-right:15px" class="text-right">\
|
||||
<button class="btn btn-success btn-sm mr5" onclick="setOpCfg()">刷新</button>\
|
||||
<button class="btn btn-success btn-sm" onclick="submitConf()">保存</button>\
|
||||
</div>\
|
||||
</div>'
|
||||
$(".soft-man-con").html(con);
|
||||
});
|
||||
}
|
||||
|
||||
function submitConf() {
|
||||
var data = {
|
||||
worker_processes: $("input[name='worker_processes']").val(),
|
||||
worker_connections: $("input[name='worker_connections']").val(),
|
||||
keepalive_timeout: $("input[name='keepalive_timeout']").val(),
|
||||
zstd: $("select[name='zstd']").val() || 'on',
|
||||
brotli: $("select[name='brotli']").val() || 'on',
|
||||
gzip: $("select[name='gzip']").val() || 'on',
|
||||
gzip_min_length: $("input[name='gzip_min_length']").val(),
|
||||
gzip_comp_level: $("input[name='gzip_comp_level']").val(),
|
||||
client_max_body_size: $("input[name='client_max_body_size']").val(),
|
||||
server_names_hash_bucket_size: $("input[name='server_names_hash_bucket_size']").val(),
|
||||
client_header_buffer_size: $("input[name='client_header_buffer_size']").val(),
|
||||
};
|
||||
|
||||
// console.log(data);
|
||||
caddyPost('set_cfg', data, function(rdata){
|
||||
var rdata = $.parseJSON(rdata.data);
|
||||
// console.log(rdata);
|
||||
layer.msg(rdata.msg, { icon: rdata.status ? 1 : 2 });
|
||||
});
|
||||
}
|
||||
|
||||
function otherFunc(){
|
||||
var con = '<p class="conf_p" style="text-align:center;">\
|
||||
<button class="btn btn-default btn-sm" onclick="cronAddCheck()">添加检查任务</button> \
|
||||
<button class="btn btn-default btn-sm" onclick="cronDelCheck()">删除检查任务</button>\
|
||||
</p>';
|
||||
$(".soft-man-con").html(con);
|
||||
}
|
||||
|
||||
function cronAddCheck(){
|
||||
caddyPost('cron_add_check', {}, function(data){
|
||||
var rdata = $.parseJSON(data.data);
|
||||
layer.msg(rdata.msg, { icon: rdata.status ? 1 : 2 });
|
||||
});
|
||||
}
|
||||
|
||||
function cronDelCheck(){
|
||||
caddyPost('cron_del_check', {}, function(data){
|
||||
var rdata = $.parseJSON(data.data);
|
||||
layer.msg(rdata.msg, { icon: rdata.status ? 1 : 2 });
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,124 @@
|
||||
# coding:utf-8
|
||||
|
||||
import sys
|
||||
import io
|
||||
import os
|
||||
import time
|
||||
import json
|
||||
|
||||
web_dir = os.getcwd() + "/web"
|
||||
if os.path.exists(web_dir):
|
||||
sys.path.append(web_dir)
|
||||
os.chdir(web_dir)
|
||||
|
||||
import core.mw as mw
|
||||
from utils.crontab import crontab as MwCrontab
|
||||
|
||||
|
||||
app_debug = False
|
||||
if mw.isAppleSystem():
|
||||
app_debug = True
|
||||
|
||||
|
||||
def getPluginName():
|
||||
return 'caddy'
|
||||
|
||||
|
||||
def getPluginDir():
|
||||
return mw.getPluginDir() + '/' + getPluginName()
|
||||
|
||||
|
||||
def getServerDir():
|
||||
return mw.getServerDir() + '/' + getPluginName()
|
||||
|
||||
|
||||
def getTaskConf():
|
||||
conf = getServerDir() + "/task_config.json"
|
||||
return conf
|
||||
|
||||
|
||||
def getConfigData():
|
||||
conf = getTaskConf()
|
||||
if os.path.exists(conf):
|
||||
return json.loads(mw.readFile(getTaskConf()))
|
||||
return {
|
||||
"task_id": -1,
|
||||
"period": "minute-n",
|
||||
"where1": "3",
|
||||
"hour": "0",
|
||||
"minute": "0",
|
||||
}
|
||||
|
||||
|
||||
def createBgTask():
|
||||
removeBgTask()
|
||||
createBgTaskByName(getPluginName())
|
||||
|
||||
|
||||
def createBgTaskByName(name):
|
||||
args = getConfigData()
|
||||
_name = "[caddy]检查任务"
|
||||
res = mw.M("crontab").field("id, name").where("name=?", (_name,)).find()
|
||||
if res:
|
||||
return True
|
||||
|
||||
if "task_id" in args and args["task_id"] > 0:
|
||||
res = mw.M("crontab").field("id, name").where(
|
||||
"id=?", (args["task_id"],)).find()
|
||||
if res and res["id"] == args["task_id"]:
|
||||
print("计划任务已经存在!")
|
||||
return True
|
||||
|
||||
mw_dir = mw.getPanelDir()
|
||||
cmd = '''
|
||||
mw_dir=%s
|
||||
rname=%s
|
||||
plugin_path=%s
|
||||
script_path=%s
|
||||
''' % (mw_dir, name, getServerDir(), getPluginDir())
|
||||
cmd += 'echo "bash $script_path/check.sh"' + "\n"
|
||||
cmd += 'cd $mw_dir && bash $script_path/check.sh' + "\n"
|
||||
|
||||
params = {
|
||||
'name': _name,
|
||||
'type': args['period'],
|
||||
'week': "",
|
||||
'where1': args['where1'],
|
||||
'hour': args['hour'],
|
||||
'minute': args['minute'],
|
||||
'save': "",
|
||||
'backup_to': "",
|
||||
'stype': "toShell",
|
||||
'sname': '',
|
||||
'sbody': cmd,
|
||||
'url_address': '',
|
||||
}
|
||||
|
||||
task_id = MwCrontab.instance().add(params)
|
||||
if task_id > 0:
|
||||
args["task_id"] = task_id
|
||||
args["name"] = name
|
||||
mw.writeFile(getTaskConf(), json.dumps(args))
|
||||
|
||||
|
||||
def removeBgTask():
|
||||
cfg = getConfigData()
|
||||
if "task_id" in cfg and cfg["task_id"] > 0:
|
||||
res = mw.M("crontab").field("id, name").where(
|
||||
"id=?", (cfg["task_id"],)).find()
|
||||
if res and res["id"] == cfg["task_id"]:
|
||||
data = MwCrontab.instance().delete(cfg["task_id"])
|
||||
if data["status"]:
|
||||
cfg["task_id"] = -1
|
||||
mw.writeFile(getTaskConf(), json.dumps(cfg))
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
if len(sys.argv) > 1:
|
||||
action = sys.argv[1]
|
||||
if action == "remove":
|
||||
removeBgTask()
|
||||
elif action == "add":
|
||||
createBgTask()
|
||||
@@ -0,0 +1,87 @@
|
||||
#!/bin/bash
|
||||
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin:/opt/homebrew/bin
|
||||
export PATH
|
||||
|
||||
# cd /Users/midoks/Desktop/mwdev/server/mdserver-web/plugins/caddy && bash install.sh install 2.11
|
||||
# cd /Users/midoks/Desktop/mwdev/server/mdserver-web/plugins/caddy && bash install.sh upgrade 2.11
|
||||
# cd /www/server/mdserver-web/plugins/caddy && bash install.sh install 2.11
|
||||
|
||||
curPath=`pwd`
|
||||
rootPath=$(dirname "$curPath")
|
||||
rootPath=$(dirname "$rootPath")
|
||||
serverPath=$(dirname "$rootPath")
|
||||
|
||||
sysName=`uname`
|
||||
action=$1
|
||||
type=$2
|
||||
|
||||
OS=`uname`
|
||||
OSNAME=''
|
||||
case $(uname) in
|
||||
Darwin) OSNAME="mac" ;;
|
||||
Linux) OSNAME="linux" ;;
|
||||
esac
|
||||
|
||||
ARCH=`uname -m`
|
||||
ARCH_NAME=''
|
||||
case $(uname -m) in
|
||||
i386) ARCH_NAME="386" ;;
|
||||
i686) ARCH_NAME="386" ;;
|
||||
x86_64) ARCH_NAME="amd64" ;;
|
||||
arm) ARCH_NAME="arm64" ;;
|
||||
arm64) ARCH_NAME="arm64" ;;
|
||||
esac
|
||||
|
||||
VERSION=2.11.2
|
||||
|
||||
caddyDir=${serverPath}/source/caddy
|
||||
|
||||
Install_App()
|
||||
{
|
||||
if [ "${action}" == "install" ];then
|
||||
if [ -d $serverPath/caddy ];then
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
|
||||
mkdir -p ${caddyDir}
|
||||
# mkdir -p ${serverPath}/caddy
|
||||
echo 'install scripts ...'
|
||||
|
||||
FILE_NAME="caddy_${VERSION}_${OSNAME}_${ARCH_NAME}.tar.gz"
|
||||
|
||||
if [ ! -f ${caddyDir}/${FILE_NAME} ];then
|
||||
wget --no-check-certificate -O ${caddyDir}/${FILE_NAME} "https://github.com/caddyserver/caddy/releases/download/v${VERSION}/${FILE_NAME}"
|
||||
fi
|
||||
|
||||
|
||||
echo "cd $serverPath/source/caddy/caddy && tar -zxvf ${caddyDir}/$FILE_NAME"
|
||||
|
||||
mkdir -p cd $serverPath/source/caddy/caddy
|
||||
cd $serverPath/source/caddy/caddy && tar -zxvf ${caddyDir}/$FILE_NAME
|
||||
if [ "$OSNAME" == "mac" ];then
|
||||
xattr -cr caddy
|
||||
fi
|
||||
|
||||
if [ ! -f $serverPath/caddy/bin ];then
|
||||
mkdir -p $serverPath/caddy/bin
|
||||
mv $serverPath/source/caddy/caddy/* $serverPath/caddy/bin
|
||||
chmod +x $serverPath/caddy/bin/caddy
|
||||
fi
|
||||
|
||||
echo 'Installation of caddy completed'
|
||||
}
|
||||
|
||||
Uninstall_App()
|
||||
{
|
||||
echo 'Uninstalling caddy completed'
|
||||
}
|
||||
|
||||
action=$1
|
||||
if [ "${1}" == "install" ];then
|
||||
Install_App
|
||||
elif [ "${1}" == "upgrade" ];then
|
||||
Install_App
|
||||
else
|
||||
Uninstall_App
|
||||
fi
|
||||
@@ -91,6 +91,9 @@ def initConf():
|
||||
"/var/log/syslog.*",
|
||||
"/var/log/syslog",
|
||||
"/var/log/mail.*",
|
||||
"/var/log/mail.err.*",
|
||||
"/var/log/mail.info.*",
|
||||
"/var/log/mail.warn.*",
|
||||
"/var/log/btmp.*",
|
||||
"/var/log/sa/sa*",
|
||||
"/var/log/sysstat/sa*",
|
||||
@@ -154,18 +157,21 @@ def initConf():
|
||||
"/www/server/php/82/var/log",
|
||||
"/www/server/php/83/var/log",
|
||||
"/www/server/php/84/var/log",
|
||||
"/www/server/php/85/var/log",
|
||||
"/www/server/openresty/nginx/logs",
|
||||
"/www/server/phpmyadmin",
|
||||
"/www/server/apache/httpd/logs",
|
||||
"/www/server/redis/data",
|
||||
"/www/server/alist/data/log",
|
||||
"/www/server/dztasks/logs",
|
||||
"/www/server/rsyncd/lsyncd.log"
|
||||
"/www/server/cron",
|
||||
"/www/server/rsyncd/lsyncd.log",
|
||||
"/www/server/mdserver-web/logs",
|
||||
]
|
||||
for i in clogcom:
|
||||
if os.path.exists(i):
|
||||
content += i + "\n"
|
||||
|
||||
content += "/www/server/cron\n"
|
||||
# 清理日志
|
||||
rootDir = "/var/log"
|
||||
|
||||
|
||||
@@ -113,7 +113,7 @@ def removeBgTask():
|
||||
"id=?", (cfg["task_id"],)).find()
|
||||
if res and res["id"] == cfg["task_id"]:
|
||||
data = MwCrontab.instance().delete(cfg["task_id"])
|
||||
if data[0]:
|
||||
if data["status"]:
|
||||
cfg["task_id"] = -1
|
||||
mw.writeFile(getTaskConf(), json.dumps(cfg))
|
||||
return True
|
||||
|
||||
@@ -99,7 +99,7 @@ def readConfigTpl():
|
||||
|
||||
def status():
|
||||
data = mw.execShell(
|
||||
"ps aux|grep cloudreve |grep -v grep | grep -v python | grep -v mdserver-web | awk '{print $2}'")
|
||||
"ps -ef|grep cloudreve |grep -v grep | grep -v python | grep -v mdserver-web | awk '{print $2}'")
|
||||
|
||||
if data[0] == '':
|
||||
return 'stop'
|
||||
|
||||
@@ -45,4 +45,26 @@
|
||||
right:0; /* 首行永远固定在左侧 */
|
||||
z-index:1;
|
||||
background-color:white;
|
||||
}
|
||||
|
||||
.divtable {
|
||||
overflow: auto;
|
||||
/*border: 1px solid #ddd;*/
|
||||
}
|
||||
|
||||
.divtable table {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.divtable table thead th {
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.divtable table tbody td {
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
max-width: 200px;
|
||||
}
|
||||
@@ -1061,7 +1061,7 @@ function mysqlGetDataList(p){
|
||||
for (var j = 0; j < fields.length; j++) {
|
||||
var f = fields[j];
|
||||
if (f in dlist[i]) {
|
||||
tbody += '<td style="word-wrap:break-word;word-break:break-all;">'+dlist[i][f]+'</td>';
|
||||
tbody += '<td title="'+dlist[i][f]+'">'+dlist[i][f]+'</td>';
|
||||
} else {
|
||||
tbody += '<td>undefined</td>';
|
||||
}
|
||||
@@ -1100,7 +1100,7 @@ function mysqlProcessList(){
|
||||
for (var j = 0; j < fields.length; j++) {
|
||||
var f = fields[j];
|
||||
if (f in dlist[i]) {
|
||||
tbody += '<td>'+dlist[i][f]+'</td>';
|
||||
tbody += '<td title="'+dlist[i][f]+'">'+dlist[i][f]+'</td>';
|
||||
} else {
|
||||
tbody += '<td>undefined</td>';
|
||||
}
|
||||
@@ -1137,7 +1137,7 @@ function mysqlStatusList(){
|
||||
for (var j = 0; j < fields.length; j++) {
|
||||
var f = fields[j];
|
||||
if (f in dlist[i]) {
|
||||
tbody += '<td>'+dlist[i][f]+'</td>';
|
||||
tbody += '<td title="'+dlist[i][f]+'">'+dlist[i][f]+'</td>';
|
||||
} else {
|
||||
tbody += '<td>undefined</td>';
|
||||
}
|
||||
@@ -1174,7 +1174,7 @@ function mysqlStatsList(){
|
||||
for (var j = 0; j < fields.length; j++) {
|
||||
var f = fields[j];
|
||||
if (f in dlist[i]) {
|
||||
tbody += '<td>'+dlist[i][f]+'</td>';
|
||||
tbody += '<td title="'+dlist[i][f]+'">'+dlist[i][f]+'</td>';
|
||||
} else {
|
||||
tbody += '<td>undefined</td>';
|
||||
}
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
[general]
|
||||
# 监听地址和端口
|
||||
listen_addr = "0.0.0.0:8080"
|
||||
|
||||
# DoH 路径
|
||||
path = "/dns-query"
|
||||
|
||||
# TLS 配置(如果需要 HTTPS)
|
||||
# tls_cert_path = "/etc/doh-proxy/cert.pem"
|
||||
# tls_key_path = "/etc/doh-proxy/key.pem"
|
||||
|
||||
# 并发请求限制
|
||||
max_concurrent_requests = 512
|
||||
|
||||
# 日志文件
|
||||
log_file = "{$SERVER_PATH}/doh/doh-proxy.log"
|
||||
|
||||
[upstream]
|
||||
# 上游 DNS 服务器
|
||||
upstream_addr = "1.1.1.1:443"
|
||||
bootstrap_addr = "1.1.1.1:53"
|
||||
|
||||
# 上游 DoH 服务器 URL(如果使用标准的 DoH 端点)
|
||||
# upstream_url = "https://cloudflare-dns.com/dns-query"
|
||||
|
||||
# 超时设置
|
||||
timeout = 10
|
||||
|
||||
# 重试次数
|
||||
tries = 3
|
||||
|
||||
# 启用 TCP 保活
|
||||
tcp_keepalive = 30
|
||||
|
||||
[cache]
|
||||
# 缓存设置
|
||||
max_entries = 65536
|
||||
min_ttl = 60
|
||||
max_ttl = 3600
|
||||
|
||||
[network]
|
||||
# 网络设置
|
||||
tcp_fastopen = true
|
||||
reuse_port = true
|
||||
|
||||
[log]
|
||||
# 日志级别:debug, info, warn, error
|
||||
level = "info"
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 4.3 KiB |
Executable
+26
@@ -0,0 +1,26 @@
|
||||
<style>
|
||||
.overflow_hide {
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
vertical-align: middle;
|
||||
}
|
||||
</style>
|
||||
<div class="bt-form">
|
||||
<div class="bt-w-main">
|
||||
<div class="bt-w-menu">
|
||||
<p class="bgw" onclick="pluginService('doh');">服务</p>
|
||||
<p onclick="pluginInitD('doh');">自启动</p>
|
||||
<p onclick="dohRead();">使用说明</p>
|
||||
</div>
|
||||
<div class="bt-w-con pd15">
|
||||
<div class="soft-man-con"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
resetPluginWinHeight(530);
|
||||
$.getScript( "/plugins/file?name=doh&f=js/doh.js",function(){
|
||||
pluginService('doh');
|
||||
});
|
||||
</script>
|
||||
Executable
+248
@@ -0,0 +1,248 @@
|
||||
# coding: utf-8
|
||||
|
||||
|
||||
import time
|
||||
import os
|
||||
import sys
|
||||
import re
|
||||
import subprocess
|
||||
|
||||
web_dir = os.getcwd() + "/web"
|
||||
if os.path.exists(web_dir):
|
||||
sys.path.append(web_dir)
|
||||
os.chdir(web_dir)
|
||||
|
||||
import core.mw as mw
|
||||
|
||||
app_debug = False
|
||||
if mw.isAppleSystem():
|
||||
app_debug = True
|
||||
|
||||
|
||||
def getPluginName():
|
||||
return 'doh'
|
||||
|
||||
|
||||
def getPluginDir():
|
||||
return mw.getPluginDir() + '/' + getPluginName()
|
||||
|
||||
|
||||
def getServerDir():
|
||||
return mw.getServerDir() + '/' + getPluginName()
|
||||
|
||||
|
||||
def getInitDFile():
|
||||
if app_debug:
|
||||
return '/tmp/' + getPluginName()
|
||||
return '/etc/init.d/' + getPluginName()
|
||||
|
||||
|
||||
def getArgs():
|
||||
args = sys.argv[2:]
|
||||
tmp = {}
|
||||
args_len = len(args)
|
||||
|
||||
if args_len == 1:
|
||||
t = args[0].strip('{').strip('}')
|
||||
t = t.split(':', 1)
|
||||
tmp[t[0]] = t[1]
|
||||
elif args_len > 1:
|
||||
for i in range(len(args)):
|
||||
t = args[i].split(':', 1)
|
||||
tmp[t[0]] = t[1]
|
||||
|
||||
return tmp
|
||||
|
||||
|
||||
def checkArgs(data, ck=[]):
|
||||
for i in range(len(ck)):
|
||||
if not ck[i] in data:
|
||||
return (False, mw.returnJson(False, '参数:(' + ck[i] + ')没有!'))
|
||||
return (True, mw.returnJson(True, 'ok'))
|
||||
|
||||
|
||||
def getInitdConfTpl():
|
||||
path = getPluginDir() + "/init.d/gitea.tpl"
|
||||
return path
|
||||
|
||||
|
||||
def getInitdConf():
|
||||
path = getServerDir() + "/init.d/doh"
|
||||
return path
|
||||
|
||||
if not os.path.exists(path):
|
||||
return mw.returnJson(False, "请先安装初始化!<br/>默认地址:http://" + mw.getLocalIp() + ":3000")
|
||||
return path
|
||||
|
||||
|
||||
def getConfTpl():
|
||||
path = getPluginDir() + "/config/config.toml"
|
||||
return path
|
||||
|
||||
|
||||
def status():
|
||||
data = mw.execShell(
|
||||
"ps -ef|grep " + getPluginName() + " |grep -v grep | grep -v python | awk '{print $2}'")
|
||||
if data[0] == '':
|
||||
return 'stop'
|
||||
return 'start'
|
||||
|
||||
|
||||
def getHomeDir():
|
||||
if mw.isAppleSystem():
|
||||
user = mw.execShell(
|
||||
"who | sed -n '2, 1p' |awk '{print $1}'")[0].strip()
|
||||
return '/Users/' + user
|
||||
else:
|
||||
return 'www'
|
||||
|
||||
|
||||
|
||||
def contentReplace(content):
|
||||
|
||||
service_path = mw.getServerDir()
|
||||
content = content.replace('{$ROOT_PATH}', mw.getFatherDir())
|
||||
content = content.replace('{$SERVER_PATH}', service_path)
|
||||
return content
|
||||
|
||||
|
||||
def initDreplace():
|
||||
|
||||
file_tpl = getInitdConfTpl()
|
||||
service_path = mw.getServerDir()
|
||||
|
||||
|
||||
conf_toml = getServerDir() + '/config.toml'
|
||||
if not os.path.exists(conf_toml):
|
||||
conf_tpl = getConfTpl()
|
||||
content = mw.readFile(conf_tpl)
|
||||
mw.writeFile(conf_toml, content)
|
||||
|
||||
# systemd
|
||||
systemDir = mw.systemdCfgDir()
|
||||
systemService = systemDir + '/doh.service'
|
||||
systemServiceTpl = getPluginDir() + '/init.d/doh.service.tpl'
|
||||
if os.path.exists(systemDir) and not os.path.exists(systemService):
|
||||
service_path = mw.getServerDir()
|
||||
se_content = mw.readFile(systemServiceTpl)
|
||||
se_content = se_content.replace('{$SERVER_PATH}', service_path)
|
||||
mw.writeFile(systemService, se_content)
|
||||
mw.execShell('systemctl daemon-reload')
|
||||
|
||||
log_path = getServerDir() + '/log'
|
||||
if not os.path.exists(log_path):
|
||||
os.mkdir(log_path)
|
||||
|
||||
return ''
|
||||
|
||||
|
||||
|
||||
|
||||
def appOp(method):
|
||||
initDreplace()
|
||||
if not mw.isAppleSystem():
|
||||
data = mw.execShell('systemctl ' + method + ' ' + getPluginName())
|
||||
if data[1] == '':
|
||||
return 'ok'
|
||||
return 'fail'
|
||||
return "fail"
|
||||
|
||||
|
||||
def start():
|
||||
return appOp('start')
|
||||
|
||||
|
||||
def stop():
|
||||
return appOp('stop')
|
||||
|
||||
|
||||
def restart():
|
||||
return appOp('restart')
|
||||
|
||||
|
||||
def reload():
|
||||
return appOp('reload')
|
||||
|
||||
|
||||
def initdStatus():
|
||||
if mw.isAppleSystem():
|
||||
return "Apple Computer does not support"
|
||||
|
||||
shell_cmd = 'systemctl status ' + getPluginName() + ' | grep loaded | grep "enabled;"'
|
||||
data = mw.execShell(shell_cmd)
|
||||
if data[0] == '':
|
||||
return 'fail'
|
||||
return 'ok'
|
||||
|
||||
|
||||
def initdInstall():
|
||||
if mw.isAppleSystem():
|
||||
return "Apple Computer does not support"
|
||||
|
||||
mw.execShell('systemctl enable ' + getPluginName())
|
||||
return 'ok'
|
||||
|
||||
|
||||
def initdUinstall():
|
||||
if mw.isAppleSystem():
|
||||
return "Apple Computer does not support"
|
||||
|
||||
mw.execShell('systemctl disable ' + getPluginName())
|
||||
return 'ok'
|
||||
|
||||
|
||||
def runLog():
|
||||
log_path = getServerDir() + '/log/doh.log'
|
||||
return log_path
|
||||
|
||||
def getTotalStatistics():
|
||||
st = status()
|
||||
data = {}
|
||||
if st.strip() == 'start':
|
||||
list_count = pQuery('select count(id) as num from repository')
|
||||
count = list_count[0]["num"]
|
||||
data['status'] = True
|
||||
data['count'] = count
|
||||
data['ver'] = mw.readFile(getServerDir() + '/version.pl').strip()
|
||||
return mw.returnJson(True, 'ok', data)
|
||||
|
||||
data['status'] = False
|
||||
data['count'] = 0
|
||||
return mw.returnJson(False, 'fail', data)
|
||||
|
||||
|
||||
def uninstallPreInspection():
|
||||
return 'ok'
|
||||
|
||||
if __name__ == "__main__":
|
||||
func = sys.argv[1]
|
||||
if func == 'status':
|
||||
print(status())
|
||||
elif func == 'start':
|
||||
print(start())
|
||||
elif func == 'stop':
|
||||
print(stop())
|
||||
elif func == 'restart':
|
||||
print(restart())
|
||||
elif func == 'reload':
|
||||
print(reload())
|
||||
elif func == 'initd_status':
|
||||
print(initdStatus())
|
||||
elif func == 'initd_install':
|
||||
print(initdInstall())
|
||||
elif func == 'initd_uninstall':
|
||||
print(initdUinstall())
|
||||
elif func == 'uninstall_pre_inspection':
|
||||
print(uninstallPreInspection())
|
||||
elif func == 'run_log':
|
||||
print(runLog())
|
||||
elif func == 'post_receive_log':
|
||||
print(postReceiveLog())
|
||||
elif func == 'conf':
|
||||
print(getConf())
|
||||
elif func == 'init_conf':
|
||||
print(getInitdConf())
|
||||
elif func == 'get_total_statistics':
|
||||
print(getTotalStatistics())
|
||||
else:
|
||||
print('fail')
|
||||
Executable
+18
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"ps": "DNS over HTTPS(DoH)是一种通过HTTPS协议加密域名解析请求的技术!",
|
||||
"name": "doh",
|
||||
"title": "DoH",
|
||||
"versions": ["0.9.15"],
|
||||
"tip": "soft",
|
||||
"install_pre_inspection":false,
|
||||
"uninstall_pre_inspection":true,
|
||||
"checks": "server/doh",
|
||||
"path":"server/doh",
|
||||
"author": "doh",
|
||||
"date": "2025-11-23",
|
||||
"home": "https://github.com/DNSCrypt/doh-server",
|
||||
"type": "doh",
|
||||
"shell": "install.sh",
|
||||
"pid": "4",
|
||||
"sort": 7
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
[Unit]
|
||||
Description=DOH(DNS over HTTPS)
|
||||
After=syslog.target
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
RestartSec=2s
|
||||
Type=simple
|
||||
User=www
|
||||
Group=www
|
||||
WorkingDirectory={$SERVER_PATH}/doh
|
||||
# /www/server/doh/doh-proxy -u 127.0.0.1:53 -l 127.0.0.1:3000
|
||||
# /www/server/doh/doh-proxy -h
|
||||
ExecStart={$SERVER_PATH}/doh/doh-proxy -u 127.0.0.1:53 -l 127.0.0.1:3000
|
||||
Restart=always
|
||||
RemainAfterExit=yes
|
||||
#AmbientCapabilities=CAP_NET_BIND_SERVICE
|
||||
#CapabilityBoundingSet=CAP_NET_BIND_SERVICE
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
Executable
+102
@@ -0,0 +1,102 @@
|
||||
#!/bin/bash
|
||||
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
|
||||
export PATH
|
||||
|
||||
curPath=`pwd`
|
||||
rootPath=$(dirname "$curPath")
|
||||
rootPath=$(dirname "$rootPath")
|
||||
serverPath=$(dirname "$rootPath")
|
||||
|
||||
if [ -f ${rootPath}/bin/activate ];then
|
||||
source ${rootPath}/bin/activate
|
||||
fi
|
||||
|
||||
|
||||
# cd /www/server/mdserver-web/plugins/doh && bash install.sh install 0.9.15
|
||||
|
||||
# /www/server/doh/doh-proxy --config /www/server/doh/config.toml
|
||||
# /www/server/doh/doh-proxy --config /www/server/doh/config.toml --check
|
||||
|
||||
|
||||
# /www/server/doh/doh-proxy -u 127.0.0.1:53 -l 127.0.0.1:3000
|
||||
|
||||
# 详细状态信息
|
||||
# sudo systemctl status doh -l
|
||||
# 查看完整日志
|
||||
# sudo journalctl -u doh -n 100
|
||||
# 实时日志跟踪
|
||||
# sudo journalctl -u doh -f
|
||||
|
||||
|
||||
URL_DOWNLOAD=https://github.com/DNSCrypt/doh-server/releases/download
|
||||
|
||||
|
||||
bash ${rootPath}/scripts/getos.sh
|
||||
OSNAME=`cat ${rootPath}/data/osname.pl`
|
||||
OSNAME_ID=`cat /etc/*-release | grep VERSION_ID | awk -F = '{print $2}' | awk -F "\"" '{print $2}'`
|
||||
|
||||
Install_App()
|
||||
{
|
||||
|
||||
mkdir -p $serverPath/source/doh
|
||||
|
||||
echo '正在安装脚本文件...'
|
||||
version=$1
|
||||
|
||||
if [ "macos" == "$OSNAME" ];then
|
||||
echo "not support!"
|
||||
exit
|
||||
else
|
||||
file=doh-proxy_${version}_linux-x86_64
|
||||
fi
|
||||
|
||||
# https://github.com/DNSCrypt/doh-server/releases/download/0.9.15/doh-proxy_0.9.15_linux-aarch64.tar.bz2
|
||||
file_xz="${file}.tar.bz2"
|
||||
echo "wget -O $serverPath/source/doh/$file_xz ${URL_DOWNLOAD}/${version}/${file_xz}"
|
||||
if [ ! -f $serverPath/source/doh/$file_xz ];then
|
||||
wget --no-check-certificate -O $serverPath/source/doh/$file_xz ${URL_DOWNLOAD}/${version}/${file_xz}
|
||||
fi
|
||||
|
||||
if [ -f $serverPath/source/doh/$file_xz ];then
|
||||
cd $serverPath/source/doh && tar -xjf $file_xz
|
||||
fi
|
||||
|
||||
|
||||
echo "mv $serverPath/source/doh/doh-proxy $serverPath/doh"
|
||||
if [ -f $serverPath/source/doh/doh-proxy ];then
|
||||
mv $serverPath/source/doh/doh-proxy $serverPath/doh
|
||||
fi
|
||||
|
||||
|
||||
if [ -d $serverPath/doh ];then
|
||||
echo $version > $serverPath/doh/version.pl
|
||||
|
||||
cd ${rootPath} && python3 plugins/doh/index.py start
|
||||
cd ${rootPath} && python3 plugins/doh/index.py initd_install
|
||||
fi
|
||||
|
||||
echo 'install doh success'
|
||||
}
|
||||
|
||||
Uninstall_App()
|
||||
{
|
||||
|
||||
if [ -f /usr/lib/systemd/system/doh.service ];then
|
||||
systemctl stop doh
|
||||
systemctl disable doh
|
||||
rm -rf /usr/lib/systemd/system/doh.service
|
||||
systemctl daemon-reload
|
||||
fi
|
||||
|
||||
rm -rf $serverPath/doh
|
||||
echo 'uninstall doh success'
|
||||
}
|
||||
|
||||
|
||||
action=$1
|
||||
version=$2
|
||||
if [ "${1}" == 'install' ];then
|
||||
Install_App $version
|
||||
else
|
||||
Uninstall_App $version
|
||||
fi
|
||||
Executable
+37
@@ -0,0 +1,37 @@
|
||||
|
||||
function dohPost(method,args,callback, title){
|
||||
|
||||
var _args = null;
|
||||
if (typeof(args) == 'string'){
|
||||
_args = JSON.stringify(toArrayObject(args));
|
||||
} else {
|
||||
_args = JSON.stringify(args);
|
||||
}
|
||||
|
||||
var _title = '正在获取...';
|
||||
if (typeof(title) != 'undefined'){
|
||||
_title = title;
|
||||
}
|
||||
|
||||
var loadT = layer.msg(_title, { icon: 16, time: 0, shade: 0.3 });
|
||||
$.post('/plugins/run', {name:'doh', func:method, args:_args}, function(data) {
|
||||
layer.close(loadT);
|
||||
if (!data.status){
|
||||
layer.msg(data.msg,{icon:0,time:2000,shade: [0.3, '#000']});
|
||||
return;
|
||||
}
|
||||
|
||||
if(typeof(callback) == 'function'){
|
||||
callback(data);
|
||||
}
|
||||
},'json');
|
||||
}
|
||||
|
||||
function dohRead(){
|
||||
|
||||
var readme = '<ul class="help-info-text c7">';
|
||||
readme += '<li>DNS服务</li>';
|
||||
readme += '</ul>';
|
||||
|
||||
$('.soft-man-con').html(readme);
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
🌐 Custom DoH Proxy
|
||||
Use /dns-query endpoint
|
||||
@@ -106,7 +106,7 @@ def getPidFile():
|
||||
return tmp.groups()[0].strip()
|
||||
|
||||
def status():
|
||||
cmd = "ps aux|grep dztasks|grep -v grep|grep -v python|grep -v mdserver-web|awk '{print $2}'"
|
||||
cmd = "ps -ef|grep dztasks|grep -v grep|grep -v python|grep -v mdserver-web|awk '{print $2}'"
|
||||
data = mw.execShell(cmd)
|
||||
if data[0] == '':
|
||||
return 'stop'
|
||||
|
||||
@@ -113,7 +113,7 @@ def status():
|
||||
# if not os.path.exists(pid_file):
|
||||
# return 'stop'
|
||||
|
||||
cmd = "ps aux|grep gorse |grep -v grep | grep -v python | grep -v mdserver-web | awk '{print $2}'"
|
||||
cmd = "ps -ef|grep gorse |grep -v grep | grep -v python | grep -v mdserver-web | awk '{print $2}'"
|
||||
data = mw.execShell(cmd)
|
||||
|
||||
if data[0] == '':
|
||||
|
||||
@@ -84,7 +84,7 @@ def getPidFile():
|
||||
return tmp.groups()[0].strip()
|
||||
|
||||
def status():
|
||||
cmd = "ps aux|grep grafana |grep -v grep | grep -v python | grep -v mdserver-web | awk '{print $2}'"
|
||||
cmd = "ps -ef|grep grafana |grep -v grep | grep -v python | grep -v mdserver-web | awk '{print $2}'"
|
||||
data = mw.execShell(cmd)
|
||||
if data[0] == '':
|
||||
return 'stop'
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
"name": "haproxy",
|
||||
"title": "haproxy",
|
||||
"shell": "install.sh",
|
||||
"versions":["2.6"],
|
||||
"versions":["2.6","2.8","3.0","3.2"],
|
||||
"updates":["2.6"],
|
||||
"tip": "soft",
|
||||
"checks": "server/haproxy",
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
global
|
||||
daemon
|
||||
pidfile /tmp/haproxy.pid
|
||||
maxconn 4000
|
||||
user haproxy
|
||||
group haproxy
|
||||
|
||||
|
||||
defaults
|
||||
mode tcp
|
||||
log local local0
|
||||
option tcplog
|
||||
timeout connect 10s
|
||||
timeout client 15s
|
||||
timeout server 15s
|
||||
|
||||
|
||||
listen stats
|
||||
mode http
|
||||
bind *:10800
|
||||
stats enable
|
||||
stats refresh 10
|
||||
stats uri /haproxy
|
||||
stats realm Haproxy\ Statistics
|
||||
stats auth {$HA_USER}:{$HA_PWD}
|
||||
|
||||
|
||||
frontend tcp_frontend
|
||||
bind *:8090
|
||||
mode tcp
|
||||
default_backend tcp_backend
|
||||
|
||||
backend tcp_backend
|
||||
mode tcp
|
||||
server tcp1 192.168.1.100:8090 check
|
||||
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
global
|
||||
daemon
|
||||
pidfile /tmp/haproxy.pid
|
||||
maxconn 4000
|
||||
user haproxy
|
||||
group haproxy
|
||||
|
||||
|
||||
defaults
|
||||
mode http
|
||||
log global
|
||||
option httplog
|
||||
timeout connect 10s
|
||||
timeout client 15s
|
||||
timeout server 15s
|
||||
|
||||
|
||||
listen stats
|
||||
mode http
|
||||
bind *:10800
|
||||
stats enable
|
||||
stats refresh 10
|
||||
stats uri /haproxy
|
||||
stats realm Haproxy\ Statistics
|
||||
stats auth {$HA_USER}:{$HA_PWD}
|
||||
|
||||
|
||||
frontend rdp_frontend
|
||||
bind *:3389
|
||||
mode tcp
|
||||
option tcplog
|
||||
default_backend rdp_backend
|
||||
|
||||
backend rdp_backend
|
||||
mode tcp
|
||||
server rdp1 192.168.1.100:3389 check
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ Install_App()
|
||||
|
||||
APP_DIR=${serverPath}/source/haproxy
|
||||
mkdir -p $APP_DIR
|
||||
|
||||
echo $MIN_VERSION > $serverPath/haproxy/version.pl
|
||||
|
||||
LOCAL_ADDR=common
|
||||
cn=$(curl -fsSL -m 10 -s http://ipinfo.io/json | grep "\"country\": \"CN\"")
|
||||
@@ -59,7 +59,6 @@ Install_App()
|
||||
cd ${APP_DIR}/haproxy-${VERSION} && make TARGET=linux-glibc && make install PREFIX=$serverPath/haproxy
|
||||
fi
|
||||
|
||||
echo $MIN_VERSION > $serverPath/haproxy/version.pl
|
||||
echo '安装Haproxy成功'
|
||||
|
||||
#Haproxy日志配置
|
||||
|
||||
Executable
+101
@@ -0,0 +1,101 @@
|
||||
#!/bin/bash
|
||||
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
|
||||
export PATH
|
||||
|
||||
curPath=`pwd`
|
||||
rootPath=$(dirname "$curPath")
|
||||
rootPath=$(dirname "$rootPath")
|
||||
serverPath=$(dirname "$rootPath")
|
||||
sysName=`uname`
|
||||
|
||||
bash ${rootPath}/scripts/getos.sh
|
||||
OSNAME=`cat ${rootPath}/data/osname.pl`
|
||||
OSNAME_ID=`cat /etc/*-release | grep VERSION_ID | awk -F = '{print $2}' | awk -F "\"" '{print $2}'`
|
||||
|
||||
|
||||
VERSION=2.8.20
|
||||
MIN_VERSION=2.8
|
||||
Install_App()
|
||||
{
|
||||
echo '正在安装Haproxy软件...'
|
||||
mkdir -p $serverPath/haproxy
|
||||
|
||||
APP_DIR=${serverPath}/source/haproxy
|
||||
mkdir -p $APP_DIR
|
||||
echo $MIN_VERSION > $serverPath/haproxy/version.pl
|
||||
|
||||
LOCAL_ADDR=common
|
||||
cn=$(curl -fsSL -m 10 -s http://ipinfo.io/json | grep "\"country\": \"CN\"")
|
||||
if [ ! -z "$cn" ] || [ "$?" == "0" ] ;then
|
||||
LOCAL_ADDR=cn
|
||||
fi
|
||||
|
||||
|
||||
if [ "${LOCAL_ADDR}" == "cn" ];then
|
||||
if [ ! -f ${APP_DIR}/haproxy-${VERSION}.tar.gz ];then
|
||||
wget -O ${APP_DIR}/haproxy-${VERSION}.tar.gz https://dl.midoks.icu/soft/haproxy/haproxy-${VERSION}.tar.gz
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
if [ ! -f ${APP_DIR}/haproxy-${VERSION}.tar.gz ];then
|
||||
if [ $sysName == 'Darwin' ]; then
|
||||
wget --no-check-certificate -O ${APP_DIR}/haproxy-${VERSION}.tar.gz https://www.haproxy.org/download/${MIN_VERSION}/src/haproxy-${VERSION}.tar.gz
|
||||
else
|
||||
curl -sSLo ${APP_DIR}/haproxy-${VERSION}.tar.gz https://www.haproxy.org/download/${MIN_VERSION}/src/haproxy-${VERSION}.tar.gz
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ ! -f ${APP_DIR}/haproxy-${VERSION}.tar.gz ];then
|
||||
curl -sSLo ${APP_DIR}/haproxy-${VERSION}.tar.gz https://www.haproxy.org/download/${MIN_VERSION}/src/haproxy-${VERSION}.tar.gz
|
||||
fi
|
||||
|
||||
|
||||
cd ${APP_DIR} && tar -zxvf haproxy-${VERSION}.tar.gz
|
||||
|
||||
if [ "$OSNAME" == "macos" ];then
|
||||
cd ${APP_DIR}/haproxy-${VERSION} && make TARGET=osx && make install PREFIX=$serverPath/haproxy
|
||||
else
|
||||
cd ${APP_DIR}/haproxy-${VERSION} && make TARGET=linux-glibc && make install PREFIX=$serverPath/haproxy
|
||||
fi
|
||||
|
||||
echo '安装Haproxy成功'
|
||||
|
||||
#Haproxy日志配置
|
||||
if [ -f /etc/rsyslog.conf ];then
|
||||
find_ha=`cat /etc/rsyslog.conf | grep haproxy`
|
||||
if [ "$find_ha" != "" ];then
|
||||
echo $find_ha
|
||||
else
|
||||
echo "---------------------------------------------"
|
||||
echo "" > ${serverPath}/haproxy/haproxy.log
|
||||
echo "local0.* ${serverPath}/haproxy/haproxy.log" >> /etc/rsyslog.conf
|
||||
systemctl restart syslog
|
||||
echo "syslog默认的haproxy配置"
|
||||
echo "local0.* ${serverPath}/haproxy/haproxy.log >> /etc/rsyslog.conf"
|
||||
echo "---------------------------------------------"
|
||||
fi
|
||||
fi
|
||||
|
||||
#删除解压源码
|
||||
if [ -d ${APP_DIR}/haproxy-${VERSION} ];then
|
||||
rm -rf ${APP_DIR}/haproxy-${VERSION}
|
||||
fi
|
||||
}
|
||||
|
||||
Uninstall_App()
|
||||
{
|
||||
if [ -f $serverPath/haproxy/initd/haproxy ];then
|
||||
$serverPath/haproxy/initd/haproxy stop
|
||||
fi
|
||||
|
||||
rm -rf $serverPath/haproxy
|
||||
echo "卸载Haproxy成功"
|
||||
}
|
||||
|
||||
action=$1
|
||||
if [ "${1}" == 'install' ];then
|
||||
Install_App
|
||||
else
|
||||
Uninstall_App
|
||||
fi
|
||||
Executable
+101
@@ -0,0 +1,101 @@
|
||||
#!/bin/bash
|
||||
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
|
||||
export PATH
|
||||
|
||||
curPath=`pwd`
|
||||
rootPath=$(dirname "$curPath")
|
||||
rootPath=$(dirname "$rootPath")
|
||||
serverPath=$(dirname "$rootPath")
|
||||
sysName=`uname`
|
||||
|
||||
bash ${rootPath}/scripts/getos.sh
|
||||
OSNAME=`cat ${rootPath}/data/osname.pl`
|
||||
OSNAME_ID=`cat /etc/*-release | grep VERSION_ID | awk -F = '{print $2}' | awk -F "\"" '{print $2}'`
|
||||
|
||||
|
||||
VERSION=3.0.19
|
||||
MIN_VERSION=3.0
|
||||
Install_App()
|
||||
{
|
||||
echo '正在安装Haproxy软件...'
|
||||
mkdir -p $serverPath/haproxy
|
||||
|
||||
APP_DIR=${serverPath}/source/haproxy
|
||||
mkdir -p $APP_DIR
|
||||
echo $MIN_VERSION > $serverPath/haproxy/version.pl
|
||||
|
||||
LOCAL_ADDR=common
|
||||
cn=$(curl -fsSL -m 10 -s http://ipinfo.io/json | grep "\"country\": \"CN\"")
|
||||
if [ ! -z "$cn" ] || [ "$?" == "0" ] ;then
|
||||
LOCAL_ADDR=cn
|
||||
fi
|
||||
|
||||
|
||||
if [ "${LOCAL_ADDR}" == "cn" ];then
|
||||
if [ ! -f ${APP_DIR}/haproxy-${VERSION}.tar.gz ];then
|
||||
wget -O ${APP_DIR}/haproxy-${VERSION}.tar.gz https://dl.midoks.icu/soft/haproxy/haproxy-${VERSION}.tar.gz
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
if [ ! -f ${APP_DIR}/haproxy-${VERSION}.tar.gz ];then
|
||||
if [ $sysName == 'Darwin' ]; then
|
||||
wget --no-check-certificate -O ${APP_DIR}/haproxy-${VERSION}.tar.gz https://www.haproxy.org/download/${MIN_VERSION}/src/haproxy-${VERSION}.tar.gz
|
||||
else
|
||||
curl -sSLo ${APP_DIR}/haproxy-${VERSION}.tar.gz https://www.haproxy.org/download/${MIN_VERSION}/src/haproxy-${VERSION}.tar.gz
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ ! -f ${APP_DIR}/haproxy-${VERSION}.tar.gz ];then
|
||||
curl -sSLo ${APP_DIR}/haproxy-${VERSION}.tar.gz https://www.haproxy.org/download/${MIN_VERSION}/src/haproxy-${VERSION}.tar.gz
|
||||
fi
|
||||
|
||||
|
||||
cd ${APP_DIR} && tar -zxvf haproxy-${VERSION}.tar.gz
|
||||
|
||||
if [ "$OSNAME" == "macos" ];then
|
||||
cd ${APP_DIR}/haproxy-${VERSION} && make TARGET=osx && make install PREFIX=$serverPath/haproxy
|
||||
else
|
||||
cd ${APP_DIR}/haproxy-${VERSION} && make TARGET=linux-glibc && make install PREFIX=$serverPath/haproxy
|
||||
fi
|
||||
|
||||
echo '安装Haproxy成功'
|
||||
|
||||
#Haproxy日志配置
|
||||
if [ -f /etc/rsyslog.conf ];then
|
||||
find_ha=`cat /etc/rsyslog.conf | grep haproxy`
|
||||
if [ "$find_ha" != "" ];then
|
||||
echo $find_ha
|
||||
else
|
||||
echo "---------------------------------------------"
|
||||
echo "" > ${serverPath}/haproxy/haproxy.log
|
||||
echo "local0.* ${serverPath}/haproxy/haproxy.log" >> /etc/rsyslog.conf
|
||||
systemctl restart syslog
|
||||
echo "syslog默认的haproxy配置"
|
||||
echo "local0.* ${serverPath}/haproxy/haproxy.log >> /etc/rsyslog.conf"
|
||||
echo "---------------------------------------------"
|
||||
fi
|
||||
fi
|
||||
|
||||
#删除解压源码
|
||||
if [ -d ${APP_DIR}/haproxy-${VERSION} ];then
|
||||
rm -rf ${APP_DIR}/haproxy-${VERSION}
|
||||
fi
|
||||
}
|
||||
|
||||
Uninstall_App()
|
||||
{
|
||||
if [ -f $serverPath/haproxy/initd/haproxy ];then
|
||||
$serverPath/haproxy/initd/haproxy stop
|
||||
fi
|
||||
|
||||
rm -rf $serverPath/haproxy
|
||||
echo "卸载Haproxy成功"
|
||||
}
|
||||
|
||||
action=$1
|
||||
if [ "${1}" == 'install' ];then
|
||||
Install_App
|
||||
else
|
||||
Uninstall_App
|
||||
fi
|
||||
Executable
+101
@@ -0,0 +1,101 @@
|
||||
#!/bin/bash
|
||||
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
|
||||
export PATH
|
||||
|
||||
curPath=`pwd`
|
||||
rootPath=$(dirname "$curPath")
|
||||
rootPath=$(dirname "$rootPath")
|
||||
serverPath=$(dirname "$rootPath")
|
||||
sysName=`uname`
|
||||
|
||||
bash ${rootPath}/scripts/getos.sh
|
||||
OSNAME=`cat ${rootPath}/data/osname.pl`
|
||||
OSNAME_ID=`cat /etc/*-release | grep VERSION_ID | awk -F = '{print $2}' | awk -F "\"" '{print $2}'`
|
||||
|
||||
|
||||
VERSION=3.2.15
|
||||
MIN_VERSION=3.2
|
||||
Install_App()
|
||||
{
|
||||
echo '正在安装Haproxy软件...'
|
||||
mkdir -p $serverPath/haproxy
|
||||
|
||||
APP_DIR=${serverPath}/source/haproxy
|
||||
mkdir -p $APP_DIR
|
||||
echo $MIN_VERSION > $serverPath/haproxy/version.pl
|
||||
|
||||
LOCAL_ADDR=common
|
||||
cn=$(curl -fsSL -m 10 -s http://ipinfo.io/json | grep "\"country\": \"CN\"")
|
||||
if [ ! -z "$cn" ] || [ "$?" == "0" ] ;then
|
||||
LOCAL_ADDR=cn
|
||||
fi
|
||||
|
||||
|
||||
if [ "${LOCAL_ADDR}" == "cn" ];then
|
||||
if [ ! -f ${APP_DIR}/haproxy-${VERSION}.tar.gz ];then
|
||||
wget -O ${APP_DIR}/haproxy-${VERSION}.tar.gz https://dl.midoks.icu/soft/haproxy/haproxy-${VERSION}.tar.gz
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
if [ ! -f ${APP_DIR}/haproxy-${VERSION}.tar.gz ];then
|
||||
if [ $sysName == 'Darwin' ]; then
|
||||
wget --no-check-certificate -O ${APP_DIR}/haproxy-${VERSION}.tar.gz https://www.haproxy.org/download/${MIN_VERSION}/src/haproxy-${VERSION}.tar.gz
|
||||
else
|
||||
curl -sSLo ${APP_DIR}/haproxy-${VERSION}.tar.gz https://www.haproxy.org/download/${MIN_VERSION}/src/haproxy-${VERSION}.tar.gz
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ ! -f ${APP_DIR}/haproxy-${VERSION}.tar.gz ];then
|
||||
curl -sSLo ${APP_DIR}/haproxy-${VERSION}.tar.gz https://www.haproxy.org/download/${MIN_VERSION}/src/haproxy-${VERSION}.tar.gz
|
||||
fi
|
||||
|
||||
|
||||
cd ${APP_DIR} && tar -zxvf haproxy-${VERSION}.tar.gz
|
||||
|
||||
if [ "$OSNAME" == "macos" ];then
|
||||
cd ${APP_DIR}/haproxy-${VERSION} && make TARGET=osx && make install PREFIX=$serverPath/haproxy
|
||||
else
|
||||
cd ${APP_DIR}/haproxy-${VERSION} && make TARGET=linux-glibc && make install PREFIX=$serverPath/haproxy
|
||||
fi
|
||||
|
||||
echo '安装Haproxy成功'
|
||||
|
||||
#Haproxy日志配置
|
||||
if [ -f /etc/rsyslog.conf ];then
|
||||
find_ha=`cat /etc/rsyslog.conf | grep haproxy`
|
||||
if [ "$find_ha" != "" ];then
|
||||
echo $find_ha
|
||||
else
|
||||
echo "---------------------------------------------"
|
||||
echo "" > ${serverPath}/haproxy/haproxy.log
|
||||
echo "local0.* ${serverPath}/haproxy/haproxy.log" >> /etc/rsyslog.conf
|
||||
systemctl restart syslog
|
||||
echo "syslog默认的haproxy配置"
|
||||
echo "local0.* ${serverPath}/haproxy/haproxy.log >> /etc/rsyslog.conf"
|
||||
echo "---------------------------------------------"
|
||||
fi
|
||||
fi
|
||||
|
||||
#删除解压源码
|
||||
if [ -d ${APP_DIR}/haproxy-${VERSION} ];then
|
||||
rm -rf ${APP_DIR}/haproxy-${VERSION}
|
||||
fi
|
||||
}
|
||||
|
||||
Uninstall_App()
|
||||
{
|
||||
if [ -f $serverPath/haproxy/initd/haproxy ];then
|
||||
$serverPath/haproxy/initd/haproxy stop
|
||||
fi
|
||||
|
||||
rm -rf $serverPath/haproxy
|
||||
echo "卸载Haproxy成功"
|
||||
}
|
||||
|
||||
action=$1
|
||||
if [ "${1}" == 'install' ];then
|
||||
Install_App
|
||||
else
|
||||
Uninstall_App
|
||||
fi
|
||||
@@ -118,7 +118,7 @@ def configScriptsTpl():
|
||||
|
||||
def status():
|
||||
data = mw.execShell(
|
||||
"ps aux|grep keepalived |grep -v grep | grep -v python | grep -v mdserver-web | awk '{print $2}'")
|
||||
"ps -ef|grep keepalived |grep -v grep | grep -v python| awk '{print $2}'")
|
||||
|
||||
if data[0] == '':
|
||||
return 'stop'
|
||||
|
||||
@@ -115,7 +115,7 @@ def status():
|
||||
return 'stop'
|
||||
|
||||
# data = mw.execShell(
|
||||
# "ps aux|grep redis |grep -v grep | grep -v python | grep -v mdserver-web | awk '{print $2}'")
|
||||
# "ps -ef|grep redis |grep -v grep | grep -v python | grep -v mdserver-web | awk '{print $2}'")
|
||||
|
||||
# if data[0] == '':
|
||||
# return 'stop'
|
||||
|
||||
@@ -91,7 +91,7 @@ def getPidFile():
|
||||
return tmp.groups()[0].strip()
|
||||
|
||||
def status():
|
||||
cmd = "ps aux|grep loki |grep -v grep | grep -v python | grep -v mdserver-web | awk '{print $2}'"
|
||||
cmd = "ps -ef|grep loki |grep -v grep | grep -v python | grep -v mdserver-web | awk '{print $2}'"
|
||||
data = mw.execShell(cmd)
|
||||
if data[0] == '':
|
||||
return 'stop'
|
||||
|
||||
@@ -7,10 +7,15 @@ ifconfig ens256 172.16.204.100 netmask 255.255.255.255 broadcast 192.168.212.100
|
||||
|
||||
route add -host 172.16.204.100 dev ens256
|
||||
|
||||
|
||||
ipvsadm -A -t 172.16.204.100:80 -s rr
|
||||
ipvsadm -a -t 172.16.204.100:80 -r 172.16.204.129:80 -m
|
||||
|
||||
跨机房
|
||||
ipvsadm -A -t 154.21.1.1:8016 -s wlc
|
||||
ipvsadm -a -t 154.21.1.1:8016 -r 103.39.78.2 -i
|
||||
源
|
||||
ifconfig tunl0 154.21.1.1 netmask 255.255.255.255 up
|
||||
|
||||
# 清空LVS规则
|
||||
|
||||
ipvsadm -C
|
||||
|
||||
@@ -11,6 +11,7 @@ sysArch=`arch`
|
||||
|
||||
# cd /www/server/mdserver-web/plugins/manticoresearch && bash install.sh install 7.4.6
|
||||
# cd /www/server/mdserver-web && python3 plugins/manticoresearch/index.py run_status_test
|
||||
# cd /www/server/mdserver-web && python3 plugins/manticoresearch/index.py start
|
||||
# systemctl status manticore
|
||||
# systemctl restart manticore
|
||||
|
||||
|
||||
@@ -181,7 +181,7 @@ def removeBgTask():
|
||||
"id=?", (cfg["task_id"],)).find()
|
||||
if res and res["id"] == cfg["task_id"]:
|
||||
data = MwCrontab.instance().delete(cfg["task_id"])
|
||||
if data[0]:
|
||||
if data['status']:
|
||||
cfg["task_id"] = -1
|
||||
mw.writeFile(getTaskConf(), json.dumps(cfg))
|
||||
return True
|
||||
@@ -194,7 +194,7 @@ def removeDeltaBgTask():
|
||||
"id=?", (cfg["task_id"],)).find()
|
||||
if res and res["id"] == cfg["task_id"]:
|
||||
data = MwCrontab.instance().delete(cfg["task_id"])
|
||||
if data[0]:
|
||||
if data['status']:
|
||||
cfg["task_id"] = -1
|
||||
mw.writeFile(getTaskDeltaConf(), json.dumps(cfg))
|
||||
return True
|
||||
|
||||
@@ -585,8 +585,7 @@ def setMyDbPos():
|
||||
mw.writeFile(myfile, mycnf)
|
||||
start()
|
||||
|
||||
result = mw.execShell(
|
||||
'ps aux|grep mysqld| grep -v grep|grep -v python')
|
||||
result = mw.execShell('ps -ef|grep mysqld| grep -v grep|grep -v python')
|
||||
if len(result[0]) > 10:
|
||||
mw.writeFile('data/datadir.pl', t_datadir)
|
||||
return mw.returnJson(True, '存储目录迁移成功!')
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
"uninstall_pre_inspection":true,
|
||||
"checks": "server/mariadb",
|
||||
"path": "server/mariadb",
|
||||
"versions":["10.6","10.7","10.8","10.9","10.11","11.0","11.1","11.2","11.3","11.4","11.5","11.6","11.7","11.8"],
|
||||
"versions":["10.6","10.7","10.8","10.9","10.11","11.0","11.1","11.2","11.3","11.4","11.5","11.6","11.7","11.8","12.0"],
|
||||
"shell":"install.sh",
|
||||
"checks":"server/mariadb",
|
||||
"path":"server/mariadb",
|
||||
|
||||
@@ -13,7 +13,7 @@ sysName=`uname`
|
||||
|
||||
mariadbDir=${serverPath}/source/mariadb
|
||||
|
||||
MY_VER=11.8.2
|
||||
MY_VER=11.8.3
|
||||
|
||||
Install_app()
|
||||
{
|
||||
@@ -91,7 +91,7 @@ Install_app()
|
||||
make -j${cpuCore} && make install && make clean
|
||||
|
||||
if [ -d $serverPath/mariadb ];then
|
||||
echo '11.7' > $serverPath/mariadb/version.pl
|
||||
echo '11.8' > $serverPath/mariadb/version.pl
|
||||
echo '安装完成'
|
||||
else
|
||||
echo '安装失败'
|
||||
|
||||
Executable
+120
@@ -0,0 +1,120 @@
|
||||
#!/bin/bash
|
||||
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin:/opt/homebrew/bin
|
||||
export PATH
|
||||
|
||||
#https://dev.mysql.com/downloads/mysql/5.5.html#downloads
|
||||
#https://dev.mysql.com/downloads/file/?id=480541
|
||||
|
||||
curPath=`pwd`
|
||||
rootPath=$(dirname "$curPath")
|
||||
rootPath=$(dirname "$rootPath")
|
||||
serverPath=$(dirname "$rootPath")
|
||||
sysName=`uname`
|
||||
|
||||
mariadbDir=${serverPath}/source/mariadb
|
||||
|
||||
MY_VER=12.0.2
|
||||
|
||||
Install_app()
|
||||
{
|
||||
mkdir -p ${mariadbDir}
|
||||
echo '正在安装脚本文件...'
|
||||
|
||||
if [ "$sysName" != "Darwin" ];then
|
||||
mkdir -p /var/log/mariadb
|
||||
touch /var/log/mariadb/mariadb.log
|
||||
fi
|
||||
|
||||
# ----- cpu start ------
|
||||
if [ -z "${cpuCore}" ]; then
|
||||
cpuCore="1"
|
||||
fi
|
||||
|
||||
if [ -f /proc/cpuinfo ];then
|
||||
cpuCore=`cat /proc/cpuinfo | grep "processor" | wc -l`
|
||||
fi
|
||||
|
||||
MEM_INFO=$(free -m|grep Mem|awk '{printf("%.f",($2)/1024)}')
|
||||
if [ "${cpuCore}" != "1" ] && [ "${MEM_INFO}" != "0" ];then
|
||||
if [ "${cpuCore}" -gt "${MEM_INFO}" ];then
|
||||
cpuCore="${MEM_INFO}"
|
||||
fi
|
||||
else
|
||||
cpuCore="1"
|
||||
fi
|
||||
|
||||
if [ "$cpuCore" -gt "2" ];then
|
||||
cpuCore=`echo "$cpuCore" | awk '{printf("%.f",($1)*0.8)}'`
|
||||
else
|
||||
cpuCore="1"
|
||||
fi
|
||||
# ----- cpu end ------
|
||||
|
||||
# if [ ! -f ${mariadbDir}/mariadb-${MY_VER}.tar.gz ];then
|
||||
# wget --no-check-certificate -O ${mariadbDir}/mariadb-${MY_VER}.tar.gz --tries=3 https://mirrors.aliyun.com/mariadb/mariadb-${MY_VER}/source/mariadb-${MY_VER}.tar.gz
|
||||
# fi
|
||||
|
||||
# https://downloads.mariadb.org/interstitial/mariadb-10.9.1/source/mariadb-10.9.1.tar.gz
|
||||
if [ ! -f ${mariadbDir}/mariadb-${MY_VER}.tar.gz ];then
|
||||
wget --no-check-certificate -O ${mariadbDir}/mariadb-${MY_VER}.tar.gz --tries=3 https://archive.mariadb.org/mariadb-${MY_VER}/source/mariadb-${MY_VER}.tar.gz
|
||||
fi
|
||||
|
||||
if [ ! -d ${mariadbDir}/mariadb-${MY_VER} ];then
|
||||
cd ${mariadbDir} && tar -zxvf ${mariadbDir}/mariadb-${MY_VER}.tar.gz
|
||||
fi
|
||||
|
||||
INSTALL_CMD=cmake
|
||||
# check cmake version
|
||||
CMAKE_VERSION=`cmake -version | grep version | awk '{print $3}' | awk -F '.' '{print $1}'`
|
||||
if [ "$CMAKE_VERSION" -eq "2" ];then
|
||||
mkdir -p /var/log/mariadb
|
||||
touch /var/log/mariadb/mariadb.log
|
||||
INSTALL_CMD=cmake3
|
||||
fi
|
||||
|
||||
if [ ! -d $serverPath/mariadb ];then
|
||||
cd ${mariadbDir}/mariadb-${MY_VER} && ${INSTALL_CMD} \
|
||||
-DCMAKE_INSTALL_PREFIX=$serverPath/mariadb \
|
||||
-DMYSQL_DATADIR=$serverPath/mariadb/data/ \
|
||||
-DMYSQL_USER=mysql \
|
||||
-DMYSQL_UNIX_ADDR=$serverPath/mariadb/mysql.sock \
|
||||
-DWITH_MYISAM_STORAGE_ENGINE=1 \
|
||||
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
|
||||
-DWITH_MEMORY_STORAGE_ENGINE=1 \
|
||||
-DENABLED_LOCAL_INFILE=1 \
|
||||
-DWITH_PARTITION_STORAGE_ENGINE=1 \
|
||||
-DEXTRA_CHARSETS=all \
|
||||
-DDEFAULT_CHARSET=utf8mb4 \
|
||||
-DDEFAULT_COLLATION=utf8mb4_general_ci \
|
||||
-DCMAKE_C_COMPILER=/usr/bin/gcc \
|
||||
-DCMAKE_CXX_COMPILER=/usr/bin/g++
|
||||
make -j${cpuCore} && make install && make clean
|
||||
|
||||
if [ -d $serverPath/mariadb ];then
|
||||
echo '12.0' > $serverPath/mariadb/version.pl
|
||||
echo '安装完成'
|
||||
else
|
||||
echo '安装失败'
|
||||
echo 'install fail'>&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -d ${mariadbDir}/mariadb-${MY_VER} ];then
|
||||
rm -rf ${mariadbDir}/mariadb-${MY_VER}
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
Uninstall_app()
|
||||
{
|
||||
rm -rf $serverPath/mariadb
|
||||
echo '卸载完成'
|
||||
}
|
||||
|
||||
action=$1
|
||||
if [ "${1}" == 'install' ];then
|
||||
Install_app
|
||||
else
|
||||
Uninstall_app
|
||||
fi
|
||||
Executable
+120
@@ -0,0 +1,120 @@
|
||||
#!/bin/bash
|
||||
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin:/opt/homebrew/bin
|
||||
export PATH
|
||||
|
||||
#https://dev.mysql.com/downloads/mysql/5.5.html#downloads
|
||||
#https://dev.mysql.com/downloads/file/?id=480541
|
||||
|
||||
curPath=`pwd`
|
||||
rootPath=$(dirname "$curPath")
|
||||
rootPath=$(dirname "$rootPath")
|
||||
serverPath=$(dirname "$rootPath")
|
||||
sysName=`uname`
|
||||
|
||||
mariadbDir=${serverPath}/source/mariadb
|
||||
|
||||
MY_VER=12.1.2
|
||||
|
||||
Install_app()
|
||||
{
|
||||
mkdir -p ${mariadbDir}
|
||||
echo '正在安装脚本文件...'
|
||||
|
||||
if [ "$sysName" != "Darwin" ];then
|
||||
mkdir -p /var/log/mariadb
|
||||
touch /var/log/mariadb/mariadb.log
|
||||
fi
|
||||
|
||||
# ----- cpu start ------
|
||||
if [ -z "${cpuCore}" ]; then
|
||||
cpuCore="1"
|
||||
fi
|
||||
|
||||
if [ -f /proc/cpuinfo ];then
|
||||
cpuCore=`cat /proc/cpuinfo | grep "processor" | wc -l`
|
||||
fi
|
||||
|
||||
MEM_INFO=$(free -m|grep Mem|awk '{printf("%.f",($2)/1024)}')
|
||||
if [ "${cpuCore}" != "1" ] && [ "${MEM_INFO}" != "0" ];then
|
||||
if [ "${cpuCore}" -gt "${MEM_INFO}" ];then
|
||||
cpuCore="${MEM_INFO}"
|
||||
fi
|
||||
else
|
||||
cpuCore="1"
|
||||
fi
|
||||
|
||||
if [ "$cpuCore" -gt "2" ];then
|
||||
cpuCore=`echo "$cpuCore" | awk '{printf("%.f",($1)*0.8)}'`
|
||||
else
|
||||
cpuCore="1"
|
||||
fi
|
||||
# ----- cpu end ------
|
||||
|
||||
# if [ ! -f ${mariadbDir}/mariadb-${MY_VER}.tar.gz ];then
|
||||
# wget --no-check-certificate -O ${mariadbDir}/mariadb-${MY_VER}.tar.gz --tries=3 https://mirrors.aliyun.com/mariadb/mariadb-${MY_VER}/source/mariadb-${MY_VER}.tar.gz
|
||||
# fi
|
||||
|
||||
# https://downloads.mariadb.org/interstitial/mariadb-10.9.1/source/mariadb-10.9.1.tar.gz
|
||||
if [ ! -f ${mariadbDir}/mariadb-${MY_VER}.tar.gz ];then
|
||||
wget --no-check-certificate -O ${mariadbDir}/mariadb-${MY_VER}.tar.gz --tries=3 https://archive.mariadb.org/mariadb-${MY_VER}/source/mariadb-${MY_VER}.tar.gz
|
||||
fi
|
||||
|
||||
if [ ! -d ${mariadbDir}/mariadb-${MY_VER} ];then
|
||||
cd ${mariadbDir} && tar -zxvf ${mariadbDir}/mariadb-${MY_VER}.tar.gz
|
||||
fi
|
||||
|
||||
INSTALL_CMD=cmake
|
||||
# check cmake version
|
||||
CMAKE_VERSION=`cmake -version | grep version | awk '{print $3}' | awk -F '.' '{print $1}'`
|
||||
if [ "$CMAKE_VERSION" -eq "2" ];then
|
||||
mkdir -p /var/log/mariadb
|
||||
touch /var/log/mariadb/mariadb.log
|
||||
INSTALL_CMD=cmake3
|
||||
fi
|
||||
|
||||
if [ ! -d $serverPath/mariadb ];then
|
||||
cd ${mariadbDir}/mariadb-${MY_VER} && ${INSTALL_CMD} \
|
||||
-DCMAKE_INSTALL_PREFIX=$serverPath/mariadb \
|
||||
-DMYSQL_DATADIR=$serverPath/mariadb/data/ \
|
||||
-DMYSQL_USER=mysql \
|
||||
-DMYSQL_UNIX_ADDR=$serverPath/mariadb/mysql.sock \
|
||||
-DWITH_MYISAM_STORAGE_ENGINE=1 \
|
||||
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
|
||||
-DWITH_MEMORY_STORAGE_ENGINE=1 \
|
||||
-DENABLED_LOCAL_INFILE=1 \
|
||||
-DWITH_PARTITION_STORAGE_ENGINE=1 \
|
||||
-DEXTRA_CHARSETS=all \
|
||||
-DDEFAULT_CHARSET=utf8mb4 \
|
||||
-DDEFAULT_COLLATION=utf8mb4_general_ci \
|
||||
-DCMAKE_C_COMPILER=/usr/bin/gcc \
|
||||
-DCMAKE_CXX_COMPILER=/usr/bin/g++
|
||||
make -j${cpuCore} && make install && make clean
|
||||
|
||||
if [ -d $serverPath/mariadb ];then
|
||||
echo '12.1' > $serverPath/mariadb/version.pl
|
||||
echo '安装完成'
|
||||
else
|
||||
echo '安装失败'
|
||||
echo 'install fail'>&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -d ${mariadbDir}/mariadb-${MY_VER} ];then
|
||||
rm -rf ${mariadbDir}/mariadb-${MY_VER}
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
Uninstall_app()
|
||||
{
|
||||
rm -rf $serverPath/mariadb
|
||||
echo '卸载完成'
|
||||
}
|
||||
|
||||
action=$1
|
||||
if [ "${1}" == 'install' ];then
|
||||
Install_app
|
||||
else
|
||||
Uninstall_app
|
||||
fi
|
||||
@@ -96,7 +96,7 @@ def checkArgs(data, ck=[]):
|
||||
|
||||
|
||||
def status():
|
||||
cmd = "ps aux|grep " + getPluginName() + " |grep -v grep | grep -v mdserver-web | awk '{print $2}'"
|
||||
cmd = "ps -ef|grep " + getPluginName() + " |grep -v grep | grep -v mdserver-web | awk '{print $2}'"
|
||||
# print(cmd)
|
||||
data = mw.execShell(cmd)
|
||||
# print(data)
|
||||
|
||||
@@ -8,7 +8,7 @@ rootPath=$(dirname "$rootPath")
|
||||
serverPath=$(dirname "$rootPath")
|
||||
|
||||
sys_os=`uname`
|
||||
VERSION=1.6.38
|
||||
VERSION=1.6.39
|
||||
|
||||
echo $sys_os
|
||||
|
||||
@@ -18,7 +18,7 @@ Install_mem(){
|
||||
echo '正在安装脚本文件...'
|
||||
|
||||
if [ ! -f $serverPath/source/memcached.tar.gz ];then
|
||||
wget --no-check-certificate -O $serverPath/source/memcached/memcached.tar.gz https://www.memcached.org/files/memcached-${VERSION}.tar.gz
|
||||
wget --no-check-certificate -O $serverPath/source/memcached/memcached.tar.gz https://www.memcached.org/files/memcached-${VERSION}.tar.gz
|
||||
fi
|
||||
|
||||
cd $serverPath/source/memcached && tar -zxvf memcached.tar.gz
|
||||
|
||||
@@ -269,6 +269,15 @@ label.checkbox_label span {
|
||||
<ul id="db_li"></ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="checkbox_data">
|
||||
<div class="checkbox_item">
|
||||
<label class="checkbox_label">
|
||||
<input type="checkbox" id="plugin_All" checked>
|
||||
<span>插件</span>
|
||||
</label>
|
||||
<ul id="plugin_li"></ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="line mtb20" style="margin:20px 0 0 50px">
|
||||
<button class="btn btn-default btn-sm mr20 dataBack">上一步</button>
|
||||
|
||||
@@ -76,6 +76,16 @@ class classApi:
|
||||
t = {'name': i}
|
||||
databases.append(t)
|
||||
data['databases'] = databases
|
||||
|
||||
|
||||
plugin = []
|
||||
for i in args['plugin']:
|
||||
# print('db:', i)
|
||||
if i == '':
|
||||
continue
|
||||
t = {'name': i}
|
||||
plugin.append(t)
|
||||
data['plugin'] = plugin
|
||||
return data
|
||||
|
||||
def fock_process(self, args):
|
||||
@@ -220,7 +230,7 @@ class classApi:
|
||||
def close_sync(self, args):
|
||||
# 取消迁移
|
||||
mw.execShell("kill -9 {}".format(self.get_pid()))
|
||||
mw.execShell("kill -9 $(ps aux|grep index.py|grep -v grep|awk '{print $2}')")
|
||||
mw.execShell("kill -9 $(ps -ef|grep index.py|grep -v grep|awk '{print $2}')")
|
||||
# 删除迁移配置
|
||||
time.sleep(1)
|
||||
if os.path.exists(self._INFO_FILE):
|
||||
@@ -753,6 +763,59 @@ class classApi:
|
||||
except:
|
||||
self.error(mw.getTracebackInfo())
|
||||
|
||||
|
||||
def print_directory_tree(self, directory, prefix=""):
|
||||
"""递归打印目录树结构"""
|
||||
items = sorted(os.listdir(directory))
|
||||
for i, item in enumerate(items):
|
||||
item_path = os.path.join(directory, item)
|
||||
is_last = i == len(items) - 1
|
||||
|
||||
if os.path.isdir(item_path):
|
||||
print(f"{prefix}{'└── ' if is_last else '├── '}{item}/")
|
||||
extension = " " if is_last else "│ "
|
||||
self.print_directory_tree(item_path, prefix + extension)
|
||||
else:
|
||||
print(f"{prefix}{'└── ' if is_last else '├── '}{item}")
|
||||
|
||||
def upload_dir(self, src, dst):
|
||||
"""递归打印目录树结构"""
|
||||
items = sorted(os.listdir(src))
|
||||
for i, item in enumerate(items):
|
||||
item_path = os.path.join(src, item)
|
||||
is_last = i == len(items) - 1
|
||||
|
||||
if os.path.isdir(item_path):
|
||||
# print("dir:",item_path, dst+'/'+item)
|
||||
self.upload_dir(item_path, dst+'/'+item)
|
||||
else:
|
||||
# print("file:",item_path, dst+'/'+item)
|
||||
self.upload_file(item_path, dst+'/'+item)
|
||||
|
||||
def sync_plugin_webssh(self):
|
||||
name = "webssh"
|
||||
webssh_dir = mw.getServerDir()+'/'+name
|
||||
|
||||
# 递归遍历所有文件和目录并打印
|
||||
print(f"\n目录树结构: {webssh_dir}")
|
||||
print("=" * 50)
|
||||
if os.path.exists(webssh_dir):
|
||||
# self.print_directory_tree(webssh_dir)
|
||||
self.upload_dir(webssh_dir, "/www/server/"+name)
|
||||
else:
|
||||
print(f"目录不存在: {webssh_dir}")
|
||||
print("=" * 50)
|
||||
|
||||
|
||||
def sync_plugin(self):
|
||||
data = getCfgData()
|
||||
plugin = self._SYNC_INFO['plugin']
|
||||
for x in plugin:
|
||||
if x['name'] == 'webssh':
|
||||
self.sync_plugin_webssh()
|
||||
return True
|
||||
|
||||
|
||||
def run(self):
|
||||
# 开始迁移
|
||||
# self.upload_file("/tmp/mysql-boost-5.7.39.tar.gz", "/tmp/mysql-boost-5.7.39.tar.gz")
|
||||
@@ -761,6 +824,7 @@ class classApi:
|
||||
self.sync_site()
|
||||
self.sync_database()
|
||||
# self.sync_path()
|
||||
self.sync_plugin()
|
||||
self.write_speed('action', 'True')
|
||||
write_log('|-所有项目迁移完成!')
|
||||
|
||||
@@ -904,7 +968,7 @@ def get_src_config(args):
|
||||
data['webserver'] = 'OpenResty'
|
||||
data['php'] = []
|
||||
phpversions = ['52', '53', '54', '55', '56', '70', '71',
|
||||
'72', '73', '74', '80', '81', '82', '83', '84']
|
||||
'72', '73', '74', '80', '81', '82', '83', '84', '85']
|
||||
phpPath = sdir + '/php/'
|
||||
for pv in phpversions:
|
||||
if not os.path.exists(phpPath + pv + '/bin/php'):
|
||||
@@ -952,6 +1016,13 @@ def get_src_info(args):
|
||||
my_db_pos = mw.getServerDir() + '/mysql'
|
||||
conn = mw.M('databases').dbPos(my_db_pos, 'mysql')
|
||||
data['databases'] = conn.field('id,name,ps').order("id desc").select()
|
||||
data['plugin'] = []
|
||||
|
||||
plugin_webssh_name = "webssh"
|
||||
webssh_dir = mw.getServerDir() + '/'+plugin_webssh_name
|
||||
if os.path.exists(webssh_dir):
|
||||
data['plugin'].append(plugin_webssh_name)
|
||||
|
||||
return data
|
||||
|
||||
|
||||
@@ -961,7 +1032,7 @@ def stepThree():
|
||||
|
||||
|
||||
def getPid():
|
||||
cmd = "ps aux|grep 'plugins/migration_api/index.py bg_process' |grep -v grep|awk '{print $2}'|xargs"
|
||||
cmd = "ps -ef|grep 'plugins/migration_api/index.py bg_process' |grep -v grep|awk '{print $2}'|xargs"
|
||||
result = mw.execShell(cmd)[0].strip()
|
||||
if not result:
|
||||
return None
|
||||
@@ -1000,11 +1071,13 @@ def stepFour():
|
||||
|
||||
sites = args['sites']
|
||||
databases = args['databases']
|
||||
plugin = args['plugin']
|
||||
|
||||
data = getCfgData()
|
||||
args = {
|
||||
'sites': sites.strip(',').split(','),
|
||||
'databases': databases.strip(',').split(',')
|
||||
'databases': databases.strip(',').split(','),
|
||||
'plugin': plugin.strip(',').split(',')
|
||||
}
|
||||
api = classApi(data['url'], data['app_id'],data['app_secret'])
|
||||
return api.set_sync_info(args)
|
||||
|
||||
@@ -187,6 +187,18 @@ function initStep3(){
|
||||
}
|
||||
$('#db_li').html(db_li);
|
||||
|
||||
|
||||
var plugin_li = '';
|
||||
for (var i = 0; i < pdata.plugin.length; i++) {
|
||||
plugin_li+='<li>\
|
||||
<label>\
|
||||
<input type="checkbox" data-id="'+i+'" id="plugin_'+pdata.plugin[i]+'" value="'+pdata.plugin[i]+'" name="plugin" checked="">\
|
||||
<span title="'+pdata.plugin[i]+'">'+pdata.plugin[i]+'</span>\
|
||||
</label>\
|
||||
</li>';
|
||||
}
|
||||
$('#plugin_li').html(plugin_li);
|
||||
|
||||
$('.psync_path').hide();
|
||||
$('.psync_data').show();
|
||||
}
|
||||
@@ -242,7 +254,12 @@ function initStep4(){
|
||||
databases_checked+=$(this).val()+',';
|
||||
});
|
||||
|
||||
maPost('step_four',{sites:site_checked,databases:databases_checked}, function(rdata){
|
||||
var plugin_checked = '';
|
||||
$('input[name="plugin"]:checked').each(function(){
|
||||
plugin_checked+=$(this).val()+',';
|
||||
});
|
||||
|
||||
maPost('step_four',{sites:site_checked,databases:databases_checked,plugin:plugin_checked}, function(rdata){
|
||||
var rdata = $.parseJSON(rdata.data);
|
||||
selectProgress(4);
|
||||
|
||||
@@ -318,6 +335,11 @@ function initStep(){
|
||||
$('#db_li input').prop('checked',ch);
|
||||
});
|
||||
|
||||
$('#plugin_All').on('click',function(){
|
||||
var ch = $(this).prop('checked');
|
||||
$('#plugin_li input').prop('checked',ch);
|
||||
});
|
||||
|
||||
$('.psync_migrate').on('click', '.okBtn', function(){
|
||||
$('.psync_migrate').hide();
|
||||
$('.psync_info').show();
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
#!/bin/bash
|
||||
|
||||
# MongoDB 监控脚本
|
||||
# 功能:检查 MongoDB 是否运行,如果停止则自动重启
|
||||
|
||||
# MongoDB 服务名称(根据你的系统配置调整)
|
||||
SERVICE_NAME="mongod"
|
||||
|
||||
# 检查 MongoDB 状态函数
|
||||
check_mongodb() {
|
||||
# 检查 MongoDB 进程是否在运行
|
||||
if pgrep -x "$SERVICE_NAME" > /dev/null; then
|
||||
echo "$(date): MongoDB 正在运行"
|
||||
return 0
|
||||
else
|
||||
echo "$(date): MongoDB 已停止"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
# 重启 MongoDB 函数
|
||||
restart_mongodb() {
|
||||
echo "$(date): 尝试重启 MongoDB..."
|
||||
|
||||
# 根据你的系统选择适当的命令
|
||||
# 对于使用 systemd 的系统(如 Ubuntu 16.04+, CentOS 7+)
|
||||
if systemctl restart "mongodb"; then
|
||||
echo "$(date): MongoDB 重启成功"
|
||||
return 0
|
||||
else
|
||||
echo "$(date): MongoDB 重启失败"
|
||||
return 1
|
||||
fi
|
||||
|
||||
# 对于使用 init.d 的系统
|
||||
# service mongod restart
|
||||
}
|
||||
|
||||
if ! check_mongodb; then
|
||||
echo "$(date): 检测到 MongoDB 停止运行"
|
||||
restart_mongodb
|
||||
fi
|
||||
@@ -63,6 +63,7 @@
|
||||
<p onclick="mongoStatus();">负载状态</p>
|
||||
<p onclick="mongoReplStatus();">复制状态</p>
|
||||
<p onclick="pluginLogs('mongodb','','run_log');">日志</p>
|
||||
<p onclick="otherFunc();">维护功能</p>
|
||||
<p onclick="mgdbReadme();">相关说明</p>
|
||||
</div>
|
||||
<div class="bt-w-con pd15">
|
||||
|
||||
+66
-14
@@ -196,25 +196,55 @@ def mongdbClientS():
|
||||
mg_root = pSqliteDb('config').where('id=?', (1,)).getField('mg_root')
|
||||
|
||||
if auth == 'disabled':
|
||||
client = pymongo.MongoClient(host=ip, port=int(port), directConnection=True)
|
||||
client = pymongo.MongoClient(host=ip, port=int(port))
|
||||
else:
|
||||
# print(auth,mg_root)
|
||||
client = pymongo.MongoClient(host=ip, port=int(port), directConnection=True, username='root',password=mg_root)
|
||||
# 使用 admin 数据库进行认证,兼容 MongoDB 3.0
|
||||
client = pymongo.MongoClient(host=ip, port=int(port), username='root', password=mg_root, authSource='admin')
|
||||
return client
|
||||
|
||||
def getMongoDBVersion():
|
||||
'''获取MongoDB版本号'''
|
||||
import pymongo
|
||||
port = getConfPort()
|
||||
ip = getConfLocalIp()
|
||||
try:
|
||||
# 先不使用认证连接
|
||||
client = pymongo.MongoClient(host=ip, port=int(port), serverSelectionTimeoutMS=5000)
|
||||
db = client.admin
|
||||
serverStatus = db.command('serverStatus')
|
||||
version = serverStatus.get('version', '4.0')
|
||||
client.close()
|
||||
return version
|
||||
except Exception as e:
|
||||
# 如果无法获取版本,默认返回 4.0(新版本兼容模式)
|
||||
return '4.0'
|
||||
|
||||
def isMongoDB3x():
|
||||
'''判断是否为MongoDB 3.x版本'''
|
||||
version = getMongoDBVersion()
|
||||
# 匹配 3.x 版本
|
||||
if version.startswith('3.'):
|
||||
return True
|
||||
return False
|
||||
|
||||
def mongdbClient():
|
||||
import pymongo
|
||||
port = getConfPort()
|
||||
auth = getConfAuth()
|
||||
ip = getConfLocalIp()
|
||||
mg_root = pSqliteDb('config').where('id=?', (1,)).getField('mg_root')
|
||||
# print(ip,port,auth,mg_root)
|
||||
|
||||
if auth == 'disabled':
|
||||
client = pymongo.MongoClient(host=ip, port=int(port), directConnection=True)
|
||||
client = pymongo.MongoClient(host=ip, port=int(port))
|
||||
else:
|
||||
# uri = "mongodb://root:"+mg_root+"@127.0.0.1:"+str(port)
|
||||
# client = pymongo.MongoClient(uri)
|
||||
client = pymongo.MongoClient(host=ip, port=int(port), directConnection=True, username='root',password=mg_root)
|
||||
# 根据MongoDB版本选择认证方式
|
||||
if isMongoDB3x():
|
||||
# MongoDB 3.x 使用 authSource 指定认证数据库
|
||||
client = pymongo.MongoClient(host=ip, port=int(port), username='root', password=mg_root, authSource='admin')
|
||||
else:
|
||||
# MongoDB 4.x+ 默认在 admin 数据库认证
|
||||
client = pymongo.MongoClient(host=ip, port=int(port), username='root', password=mg_root)
|
||||
return client
|
||||
|
||||
|
||||
@@ -711,7 +741,6 @@ def setRootPwd(version=''):
|
||||
def setUserPwd(version=''):
|
||||
|
||||
client = mongdbClient()
|
||||
db = client.admin
|
||||
sqlite_db = pSqliteDb('databases')
|
||||
|
||||
args = getArgs()
|
||||
@@ -724,6 +753,8 @@ def setUserPwd(version=''):
|
||||
uid = args['id']
|
||||
try:
|
||||
name = sqlite_db.where('id=?', (uid,)).getField('name')
|
||||
# 将用户创建在目标数据库中,而不是 admin 数据库
|
||||
db = client[name]
|
||||
user_roles = [{'role': 'dbOwner', 'db': name}, {'role': 'userAdmin', 'db': name}]
|
||||
|
||||
try:
|
||||
@@ -824,16 +855,16 @@ def getDbInfo():
|
||||
|
||||
def toDbBase(find):
|
||||
client = mongdbClient()
|
||||
db_admin = client.admin
|
||||
data_name = find['name']
|
||||
db = client[data_name]
|
||||
|
||||
db.zchat.insert_one({})
|
||||
user_roles = [{'role': 'dbOwner', 'db': data_name}, {'role': 'userAdmin', 'db': data_name}]
|
||||
# 将用户创建在目标数据库中,而不是 admin 数据库
|
||||
try:
|
||||
db_admin.command("createUser", find['username'], pwd=find['password'], roles=user_roles)
|
||||
db.command("createUser", find['username'], pwd=find['password'], roles=user_roles)
|
||||
except Exception as e:
|
||||
db_admin.command("updateUser", find['username'], pwd=find['password'], roles=user_roles)
|
||||
db.command("updateUser", find['username'], pwd=find['password'], roles=user_roles)
|
||||
return 1
|
||||
|
||||
def syncToDatabases():
|
||||
@@ -990,7 +1021,8 @@ def setDbAccess():
|
||||
user_roles.append(t)
|
||||
|
||||
client = mongdbClient()
|
||||
db = client.admin
|
||||
# 在目标数据库中操作用户,而不是 admin 数据库
|
||||
db = client[name]
|
||||
|
||||
try:
|
||||
db.command("updateUser", username, pwd=mg_pass, roles=user_roles)
|
||||
@@ -1524,11 +1556,27 @@ def runLog():
|
||||
return f
|
||||
return getServerDir() + '/logs.pl'
|
||||
|
||||
def cronAddCheck():
|
||||
try:
|
||||
import tool_task
|
||||
tool_task.createBgTask()
|
||||
return mw.returnJson(True, '添加检查任务成功')
|
||||
except Exception as e:
|
||||
return mw.returnJson(False, '添加检查任务失败:'+str(e))
|
||||
|
||||
def cronDelCheck():
|
||||
try:
|
||||
import tool_task
|
||||
tool_task.removeBgTask()
|
||||
return mw.returnJson(True, '删除检查任务成功')
|
||||
except Exception as e:
|
||||
return mw.returnJson(False, '删除检查任务失败:'+str(e))
|
||||
|
||||
|
||||
def installPreInspectionDebainCheck(sysId,version):
|
||||
if version == '8.0':
|
||||
if sysId != '12':
|
||||
return "[%s]需要debain[12]" % (version,)
|
||||
if int(sysId) < 12:
|
||||
return "[%s]需要至少debain[12]" % (version,)
|
||||
return ''
|
||||
|
||||
def installPreInspection(version):
|
||||
@@ -1666,5 +1714,9 @@ if __name__ == "__main__":
|
||||
print(test())
|
||||
elif func == 'test_data':
|
||||
print(testData())
|
||||
elif func == 'cron_add_check':
|
||||
print(cronAddCheck())
|
||||
elif func == 'cron_del_check':
|
||||
print(cronDelCheck())
|
||||
else:
|
||||
print('error')
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
"shell": "install.sh",
|
||||
"install_pre_inspection":true,
|
||||
"uninstall_pre_inspection":true,
|
||||
"versions":["4.4","5.0","6.0","7.0","8.0"],
|
||||
"versions":["3.0","4.4","5.0","6.0","7.0","8.0","8.2"],
|
||||
"tip": "soft",
|
||||
"checks": "server/mongodb",
|
||||
"path": "server/mongodb",
|
||||
|
||||
@@ -6,9 +6,20 @@ export PATH
|
||||
|
||||
# cd /Users/midoks/Desktop/mwdev/server/mdserver-web/plugins/mongodb && /bin/bash install.sh install 7.0
|
||||
# cd /www/server/mdserver-web/plugins/mongodb && /bin/bash install.sh install 7.0
|
||||
# cd /www/server/mdserver-web/plugins/mongodb && /bin/bash install.sh install 3.0
|
||||
# cd /www/server/mdserver-web && python3 /www/server/mdserver-web/plugins/mongodb/index.py start
|
||||
|
||||
|
||||
# db.createUser({
|
||||
# user: "demo",
|
||||
# pwd: "123123",
|
||||
# roles: [{role: "dbOwner", db: "demo"}]
|
||||
# })
|
||||
|
||||
# db.auth("demo", "123123");
|
||||
# import
|
||||
# /www/server/mongodb/bin/mongorestore -h localhost -d demo --dir /tmp/*.json
|
||||
|
||||
|
||||
curPath=`pwd`
|
||||
rootPath=$(dirname "$curPath")
|
||||
@@ -78,6 +89,13 @@ Install_app()
|
||||
cd ${rootPath} && python3 ${rootPath}/plugins/mongodb/index.py start
|
||||
cd ${rootPath} && python3 ${rootPath}/plugins/mongodb/index.py initd_install
|
||||
fi
|
||||
|
||||
if [ "${VERSION}" == "3.0" ];then
|
||||
# 降低版本
|
||||
pip install pymongo==3.12.0
|
||||
else
|
||||
pip install pymongo
|
||||
fi
|
||||
}
|
||||
|
||||
Uninstall_app()
|
||||
|
||||
@@ -1241,6 +1241,28 @@ function importDbExternal(file,name){
|
||||
});
|
||||
}
|
||||
|
||||
function otherFunc(){
|
||||
var con = '<p class="conf_p" style="text-align:center;">\
|
||||
<button class="btn btn-default btn-sm" onclick="cronAddCheck()">添加检查任务</button> \
|
||||
<button class="btn btn-default btn-sm" onclick="cronDelCheck()">删除检查任务</button>\
|
||||
</p>';
|
||||
$(".soft-man-con").html(con);
|
||||
}
|
||||
|
||||
function cronAddCheck(){
|
||||
mgPost('cron_add_check', '', {}, function(data){
|
||||
var rdata = $.parseJSON(data.data);
|
||||
layer.msg(rdata.msg, { icon: rdata.status ? 1 : 2 });
|
||||
});
|
||||
}
|
||||
|
||||
function cronDelCheck(){
|
||||
mgPost('cron_del_check', '', {}, function(data){
|
||||
var rdata = $.parseJSON(data.data);
|
||||
layer.msg(rdata.msg, { icon: rdata.status ? 1 : 2 });
|
||||
});
|
||||
}
|
||||
|
||||
function mgdbReadme(){
|
||||
var readme = '<ul class="help-info-text c7">';
|
||||
readme += '<li>认证同步说明</li>';
|
||||
|
||||
@@ -122,11 +122,12 @@ def mongdbClient():
|
||||
mg_root = pSqliteDb('config').where('id=?', (1,)).getField('mg_root')
|
||||
# print(ip,port,auth,mg_root)
|
||||
if auth == 'disabled':
|
||||
client = pymongo.MongoClient(host=ip, port=int(port), directConnection=True)
|
||||
client = pymongo.MongoClient(host=ip, port=int(port))
|
||||
else:
|
||||
# uri = "mongodb://root:"+mg_root+"@127.0.0.1:"+str(port)
|
||||
# client = pymongo.MongoClient(uri)
|
||||
client = pymongo.MongoClient(host=ip, port=int(port), directConnection=True, username='root',password=mg_root)
|
||||
# 使用 admin 数据库进行认证,兼容 MongoDB 3.0
|
||||
client = pymongo.MongoClient(host=ip, port=int(port), username='root', password=mg_root, authSource='admin')
|
||||
return client
|
||||
|
||||
class backupTools:
|
||||
|
||||
@@ -0,0 +1,124 @@
|
||||
# coding:utf-8
|
||||
|
||||
import sys
|
||||
import io
|
||||
import os
|
||||
import time
|
||||
import json
|
||||
|
||||
web_dir = os.getcwd() + "/web"
|
||||
if os.path.exists(web_dir):
|
||||
sys.path.append(web_dir)
|
||||
os.chdir(web_dir)
|
||||
|
||||
import core.mw as mw
|
||||
from utils.crontab import crontab as MwCrontab
|
||||
|
||||
|
||||
app_debug = False
|
||||
if mw.isAppleSystem():
|
||||
app_debug = True
|
||||
|
||||
|
||||
def getPluginName():
|
||||
return 'mongodb'
|
||||
|
||||
|
||||
def getPluginDir():
|
||||
return mw.getPluginDir() + '/' + getPluginName()
|
||||
|
||||
|
||||
def getServerDir():
|
||||
return mw.getServerDir() + '/' + getPluginName()
|
||||
|
||||
|
||||
def getTaskConf():
|
||||
conf = getServerDir() + "/task_config.json"
|
||||
return conf
|
||||
|
||||
|
||||
def getConfigData():
|
||||
conf = getTaskConf()
|
||||
if os.path.exists(conf):
|
||||
return json.loads(mw.readFile(getTaskConf()))
|
||||
return {
|
||||
"task_id": -1,
|
||||
"period": "minute-n",
|
||||
"where1": "1",
|
||||
"hour": "0",
|
||||
"minute": "0",
|
||||
}
|
||||
|
||||
|
||||
def createBgTask():
|
||||
removeBgTask()
|
||||
createBgTaskByName(getPluginName())
|
||||
|
||||
|
||||
def createBgTaskByName(name):
|
||||
args = getConfigData()
|
||||
_name = "[MongoDB]检查任务"
|
||||
res = mw.M("crontab").field("id, name").where("name=?", (_name,)).find()
|
||||
if res:
|
||||
return True
|
||||
|
||||
if "task_id" in args and args["task_id"] > 0:
|
||||
res = mw.M("crontab").field("id, name").where(
|
||||
"id=?", (args["task_id"],)).find()
|
||||
if res and res["id"] == args["task_id"]:
|
||||
print("计划任务已经存在!")
|
||||
return True
|
||||
|
||||
mw_dir = mw.getPanelDir()
|
||||
cmd = '''
|
||||
mw_dir=%s
|
||||
rname=%s
|
||||
plugin_path=%s
|
||||
script_path=%s
|
||||
''' % (mw_dir, name, getServerDir(), getPluginDir())
|
||||
cmd += 'echo "bash $script_path/check.sh"' + "\n"
|
||||
cmd += 'cd $mw_dir && bash $script_path/check.sh' + "\n"
|
||||
|
||||
params = {
|
||||
'name': _name,
|
||||
'type': args['period'],
|
||||
'week': "",
|
||||
'where1': args['where1'],
|
||||
'hour': args['hour'],
|
||||
'minute': args['minute'],
|
||||
'save': "",
|
||||
'backup_to': "",
|
||||
'stype': "toShell",
|
||||
'sname': '',
|
||||
'sbody': cmd,
|
||||
'url_address': '',
|
||||
}
|
||||
|
||||
task_id = MwCrontab.instance().add(params)
|
||||
if task_id > 0:
|
||||
args["task_id"] = task_id
|
||||
args["name"] = name
|
||||
mw.writeFile(getTaskConf(), json.dumps(args))
|
||||
|
||||
|
||||
def removeBgTask():
|
||||
cfg = getConfigData()
|
||||
if "task_id" in cfg and cfg["task_id"] > 0:
|
||||
res = mw.M("crontab").field("id, name").where(
|
||||
"id=?", (cfg["task_id"],)).find()
|
||||
if res and res["id"] == cfg["task_id"]:
|
||||
data = MwCrontab.instance().delete(cfg["task_id"])
|
||||
if data["status"]:
|
||||
cfg["task_id"] = -1
|
||||
mw.writeFile(getTaskConf(), json.dumps(cfg))
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
if len(sys.argv) > 1:
|
||||
action = sys.argv[1]
|
||||
if action == "remove":
|
||||
removeBgTask()
|
||||
elif action == "add":
|
||||
createBgTask()
|
||||
@@ -0,0 +1,68 @@
|
||||
#!/bin/bash
|
||||
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin:/opt/homebrew/bin
|
||||
export PATH
|
||||
|
||||
curPath=`pwd`
|
||||
rootPath=$(dirname "$curPath")
|
||||
rootPath=$(dirname "$rootPath")
|
||||
rootPath=$(dirname "$rootPath")
|
||||
serverPath=$(dirname "$rootPath")
|
||||
|
||||
VERSION=3.0.15
|
||||
SYS_ARCH=`arch`
|
||||
|
||||
SYS_VERSION_ID=`cat /etc/*-release | grep VERSION_ID | awk -F = '{print $2}' | awk -F "\"" '{print $2}'`
|
||||
SYS_NAME=${SYS_VERSION_ID/./}
|
||||
SYS_NAME_LEN=`echo "$SYS_NAME" | wc -L`
|
||||
|
||||
if [ "$SYS_NAME_LEN" == "1" ];then
|
||||
SYS_NAME=${SYS_NAME}0
|
||||
fi
|
||||
|
||||
if [ "$SYS_ARCH" == "aarch64" ];then
|
||||
if [ "$SYS_NAME" -gt "82" ];then
|
||||
SYS_NAME="82"
|
||||
fi
|
||||
|
||||
if [ "$SYS_NAME" -lt "62" ];then
|
||||
SYS_NAME="62"
|
||||
fi
|
||||
else
|
||||
|
||||
if [ "$SYS_NAME" -gt "80" ];then
|
||||
SYS_NAME="80"
|
||||
fi
|
||||
|
||||
if [ "$SYS_NAME" -lt "70" ];then
|
||||
SYS_NAME="70"
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
# https://fastdl.mongodb.org/linux/mongodb-linux-aarch64-rhel82-4.4.23.tgz
|
||||
# https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-rhel70-4.4.23.tgz
|
||||
# https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-rhel80-4.4.23.tgz
|
||||
# https://fastdl.mongodb.org/linux/mongodb-linux-aarch64-rhel82-4.4.23.tgz
|
||||
# https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-rhel80-4.4.23.tgz
|
||||
|
||||
MG_DIR=$serverPath/source/mongodb
|
||||
mkdir -p $MG_DIR
|
||||
|
||||
FILE_NAME=mongodb-linux-${SYS_ARCH}-${VERSION}
|
||||
FILE_NAME_TGZ=${FILE_NAME}.tgz
|
||||
|
||||
if [ ! -f $MG_DIR/${FILE_NAME_TGZ} ]; then
|
||||
wget --no-check-certificate -O $MG_DIR/${FILE_NAME_TGZ} https://fastdl.mongodb.org/linux/${FILE_NAME_TGZ}
|
||||
echo "wget --no-check-certificate -O $MG_DIR/${FILE_NAME_TGZ} https://fastdl.mongodb.org/linux/${FILE_NAME_TGZ}"
|
||||
fi
|
||||
|
||||
if [ ! -d $MG_DIR/${FILE_NAME} ];then
|
||||
cd $MG_DIR && tar -zxvf ${FILE_NAME_TGZ}
|
||||
fi
|
||||
|
||||
if [ ! -d $serverPath/mongodb/bin ];then
|
||||
mkdir -p $serverPath/mongodb
|
||||
cd $MG_DIR/${FILE_NAME} && cp -rf ./bin $serverPath/mongodb
|
||||
fi
|
||||
|
||||
cd ${MG_DIR} && rm -rf ${MG_DIR}/${FILE_NAME}
|
||||
@@ -0,0 +1,50 @@
|
||||
#!/bin/bash
|
||||
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin:/opt/homebrew/bin
|
||||
export PATH
|
||||
|
||||
curPath=`pwd`
|
||||
rootPath=$(dirname "$curPath")
|
||||
rootPath=$(dirname "$rootPath")
|
||||
rootPath=$(dirname "$rootPath")
|
||||
serverPath=$(dirname "$rootPath")
|
||||
|
||||
# https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-3.0.15.tgz
|
||||
VERSION=3.0.15
|
||||
SYS_ARCH=`arch`
|
||||
SYS_VERSION_ID=`cat /etc/*-release | grep VERSION_ID | awk -F = '{print $2}' | awk -F "\"" '{print $2}'`
|
||||
SYS_NAME=${SYS_VERSION_ID/./}
|
||||
|
||||
if [ "$SYS_NAME" -gt "10" ];then
|
||||
SYS_NAME="10"
|
||||
fi
|
||||
|
||||
if [ "$SYS_NAME" -lt "10" ];then
|
||||
SYS_NAME="10"
|
||||
fi
|
||||
|
||||
# FILE_NAME=mongodb-linux-${SYS_ARCH}-debian${SYS_NAME}-${VERSION}
|
||||
FILE_NAME=mongodb-linux-${SYS_ARCH}-${VERSION}
|
||||
FILE_NAME_TGZ=${FILE_NAME}.tgz
|
||||
|
||||
|
||||
MG_DIR=$serverPath/source/mongodb
|
||||
mkdir -p $MG_DIR
|
||||
|
||||
if [ ! -f $MG_DIR/${FILE_NAME_TGZ} ]; then
|
||||
wget --no-check-certificate -O $MG_DIR/${FILE_NAME_TGZ} https://fastdl.mongodb.org/linux/${FILE_NAME_TGZ}
|
||||
echo "wget --no-check-certificate -O $MG_DIR/${FILE_NAME_TGZ} https://fastdl.mongodb.org/linux/${FILE_NAME_TGZ}"
|
||||
fi
|
||||
|
||||
if [ ! -d $MG_DIR/${FILE_NAME_TGZ} ];then
|
||||
cd $MG_DIR && tar -zxvf ${FILE_NAME_TGZ}
|
||||
fi
|
||||
|
||||
if [ ! -d $serverPath/mongodb/bin ];then
|
||||
mkdir -p $serverPath/mongodb
|
||||
cd $MG_DIR/${FILE_NAME} && cp -rf ./bin $serverPath/mongodb
|
||||
fi
|
||||
|
||||
cd ${MG_DIR} && rm -rf ${MG_DIR}/${FILE_NAME}
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
#!/bin/bash
|
||||
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin:/opt/homebrew/bin
|
||||
export PATH
|
||||
|
||||
curPath=`pwd`
|
||||
rootPath=$(dirname "$curPath")
|
||||
rootPath=$(dirname "$rootPath")
|
||||
rootPath=$(dirname "$rootPath")
|
||||
serverPath=$(dirname "$rootPath")
|
||||
|
||||
# https://fastdl.mongodb.org/osx/mongodb-osx-x86_64-3.0.15.tgz
|
||||
VERSION=3.0.15
|
||||
|
||||
MG_DIR=$serverPath/source/mongodb
|
||||
mkdir -p $MG_DIR
|
||||
|
||||
if [ ! -f $MG_DIR/mongodb-macos-x86_64-${VERSION}.tgz ]; then
|
||||
wget --no-check-certificate -O $MG_DIR/mongodb-macos-x86_64-${VERSION}.tgz https://fastdl.mongodb.org/osx/mongodb-macos-x86_64-${VERSION}.tgz
|
||||
echo "wget --no-check-certificate -O $MG_DIR/mongodb-macos-x86_64-${VERSION}.tgz https://fastdl.mongodb.org/osx/mongodb-macos-x86_64-${VERSION}.tgz"
|
||||
fi
|
||||
|
||||
if [ ! -d $MG_DIR/mongodb-macos-x86_64-${VERSION} ];then
|
||||
cd $MG_DIR && tar -zxvf mongodb-macos-x86_64-${VERSION}.tgz
|
||||
fi
|
||||
|
||||
if [ ! -d $serverPath/mongodb/bin ];then
|
||||
mkdir -p $serverPath/mongodb
|
||||
cd $MG_DIR/mongodb-macos-x86_64-${VERSION} && cp -rf ./bin $serverPath/mongodb
|
||||
fi
|
||||
@@ -0,0 +1,48 @@
|
||||
#!/bin/bash
|
||||
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin:/opt/homebrew/bin
|
||||
export PATH
|
||||
|
||||
curPath=`pwd`
|
||||
rootPath=$(dirname "$curPath")
|
||||
rootPath=$(dirname "$rootPath")
|
||||
rootPath=$(dirname "$rootPath")
|
||||
serverPath=$(dirname "$rootPath")
|
||||
|
||||
VERSION=3.0.15
|
||||
SYS_ARCH=`arch`
|
||||
|
||||
SYS_VERSION_ID=`cat /etc/*-release | grep VERSION_ID | awk -F = '{print $2}' | awk -F "\"" '{print $2}' | awk -F . '{print $1}'`
|
||||
|
||||
SYS_NAME="15"
|
||||
if [ "$SYS_VERSION_ID" -gt "15" ];then
|
||||
SYS_NAME="15"
|
||||
fi
|
||||
|
||||
if [ "$SYS_NAME" -lt "12" ];then
|
||||
SYS_NAME="12"
|
||||
fi
|
||||
|
||||
# https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-suse15-4.4.23.tgz
|
||||
# https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-suse12-4.4.23.tgz
|
||||
|
||||
MG_DIR=$serverPath/source/mongodb
|
||||
mkdir -p $MG_DIR
|
||||
|
||||
FILE_NAME=mongodb-linux-${SYS_ARCH}-${VERSION}
|
||||
FILE_NAME_TGZ=${FILE_NAME}.tgz
|
||||
|
||||
if [ ! -f $MG_DIR/${FILE_NAME_TGZ} ]; then
|
||||
wget --no-check-certificate -O $MG_DIR/${FILE_NAME_TGZ} https://fastdl.mongodb.org/linux/${FILE_NAME_TGZ}
|
||||
echo "wget --no-check-certificate -O $MG_DIR/${FILE_NAME_TGZ} https://fastdl.mongodb.org/linux/${FILE_NAME_TGZ}"
|
||||
fi
|
||||
|
||||
if [ ! -d $MG_DIR/${FILE_NAME} ];then
|
||||
cd $MG_DIR && tar -zxvf ${FILE_NAME_TGZ}
|
||||
fi
|
||||
|
||||
if [ ! -d $serverPath/mongodb/bin ];then
|
||||
mkdir -p $serverPath/mongodb
|
||||
cd $MG_DIR/${FILE_NAME} && cp -rf ./bin $serverPath/mongodb
|
||||
fi
|
||||
|
||||
cd ${MG_DIR} && rm -rf ${MG_DIR}/${FILE_NAME}
|
||||
@@ -0,0 +1,44 @@
|
||||
#!/bin/bash
|
||||
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin:/opt/homebrew/bin
|
||||
export PATH
|
||||
|
||||
curPath=`pwd`
|
||||
rootPath=$(dirname "$curPath")
|
||||
rootPath=$(dirname "$rootPath")
|
||||
rootPath=$(dirname "$rootPath")
|
||||
serverPath=$(dirname "$rootPath")
|
||||
|
||||
VERSION=3.0.15
|
||||
SYS_ARCH=`arch`
|
||||
|
||||
SYS_VERSION_ID=`cat /etc/*-release | grep VERSION_ID | awk -F = '{print $2}' | awk -F "\"" '{print $2}'`
|
||||
SYS_NAME=${SYS_VERSION_ID/./}
|
||||
SYS_NAME_LEN=`echo "$SYS_NAME" | wc -L`
|
||||
|
||||
if [ "$SYS_NAME_LEN" == "1" ];then
|
||||
SYS_NAME=${SYS_NAME}0
|
||||
fi
|
||||
|
||||
# https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-rhel70-4.4.23.tgz
|
||||
|
||||
MG_DIR=$serverPath/source/mongodb
|
||||
mkdir -p $MG_DIR
|
||||
|
||||
FILE_NAME=mongodb-linux-${SYS_ARCH}-${VERSION}
|
||||
FILE_NAME_TGZ=${FILE_NAME}.tgz
|
||||
|
||||
if [ ! -f $MG_DIR/${FILE_NAME_TGZ} ]; then
|
||||
wget --no-check-certificate -O $MG_DIR/${FILE_NAME_TGZ} https://fastdl.mongodb.org/linux/${FILE_NAME_TGZ}
|
||||
echo "wget --no-check-certificate -O $MG_DIR/${FILE_NAME_TGZ} https://fastdl.mongodb.org/linux/${FILE_NAME_TGZ}"
|
||||
fi
|
||||
|
||||
if [ ! -d $MG_DIR/${FILE_NAME} ];then
|
||||
cd $MG_DIR && tar -zxvf ${FILE_NAME_TGZ}
|
||||
fi
|
||||
|
||||
if [ ! -d $serverPath/mongodb/bin ];then
|
||||
mkdir -p $serverPath/mongodb
|
||||
cd $MG_DIR/${FILE_NAME} && cp -rf ./bin $serverPath/mongodb
|
||||
fi
|
||||
|
||||
cd ${MG_DIR} && rm -rf ${MG_DIR}/${FILE_NAME}
|
||||
@@ -0,0 +1,46 @@
|
||||
#!/bin/bash
|
||||
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin:/opt/homebrew/bin
|
||||
export PATH
|
||||
|
||||
curPath=`pwd`
|
||||
rootPath=$(dirname "$curPath")
|
||||
rootPath=$(dirname "$rootPath")
|
||||
rootPath=$(dirname "$rootPath")
|
||||
serverPath=$(dirname "$rootPath")
|
||||
|
||||
VERSION=3.0.15
|
||||
SYS_ARCH=`arch`
|
||||
|
||||
SYS_VERSION_ID=`cat /etc/*-release | grep VERSION_ID | awk -F = '{print $2}' | awk -F "\"" '{print $2}'`
|
||||
SYS_NAME=${SYS_VERSION_ID/./}
|
||||
# https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu2004-4.4.23.tgz
|
||||
|
||||
if [ "$SYS_NAME" -gt "2004" ];then
|
||||
SYS_NAME="2004"
|
||||
fi
|
||||
|
||||
if [ "$SYS_NAME" -lt "1604" ];then
|
||||
SYS_NAME="1604"
|
||||
fi
|
||||
|
||||
MG_DIR=$serverPath/source/mongodb
|
||||
mkdir -p $MG_DIR
|
||||
|
||||
FILE_NAME=mongodb-linux-${SYS_ARCH}-${VERSION}
|
||||
FILE_NAME_TGZ=${FILE_NAME}.tgz
|
||||
|
||||
if [ ! -f $MG_DIR/${FILE_NAME_TGZ} ]; then
|
||||
wget --no-check-certificate -O $MG_DIR/${FILE_NAME_TGZ} https://fastdl.mongodb.org/linux/${FILE_NAME_TGZ}
|
||||
echo "wget --no-check-certificate -O $MG_DIR/${FILE_NAME_TGZ} https://fastdl.mongodb.org/linux/${FILE_NAME_TGZ}"
|
||||
fi
|
||||
|
||||
if [ ! -d $MG_DIR/${FILE_NAME} ];then
|
||||
cd $MG_DIR && tar -zxvf ${FILE_NAME_TGZ}
|
||||
fi
|
||||
|
||||
if [ ! -d $serverPath/mongodb/bin ];then
|
||||
mkdir -p $serverPath/mongodb
|
||||
cd $MG_DIR/${FILE_NAME} && cp -rf ./bin $serverPath/mongodb
|
||||
fi
|
||||
|
||||
cd ${MG_DIR} && rm -rf ${MG_DIR}/${FILE_NAME}
|
||||
@@ -65,7 +65,7 @@ cd ${MG_DIR} && rm -rf ${MG_DIR}/${TOOL_FILE_NAME}
|
||||
|
||||
|
||||
#--------------- mongodb database install ------------------ #
|
||||
TOOL_VERSION=100.9.4
|
||||
TOOL_VERSION=100.16.1
|
||||
TOOL_FILE_NAME=mongodb-database-tools-debian${SYS_NAME}-x86_64-${TOOL_VERSION}
|
||||
if [ "aarch64" == ${SYS_ARCH} ];then
|
||||
TOOL_FILE_NAME=mongodb-database-tools-debian${SYS_NAME}-arm64-${TOOL_VERSION}
|
||||
@@ -75,7 +75,8 @@ if [ "arm64" == ${SYS_ARCH} ];then
|
||||
TOOL_FILE_NAME=mongodb-database-tools-debian${SYS_NAME}-arm64-${TOOL_VERSION}
|
||||
fi
|
||||
|
||||
TOOL_FILE_NAME_TGZ=${TOOL_FILE_NAME}.zip
|
||||
# https://fastdl.mongodb.org/tools/db/mongodb-database-tools-debian10-x86_64-100.16.1.tgz
|
||||
TOOL_FILE_NAME_TGZ=${TOOL_FILE_NAME}.tgz
|
||||
if [ ! -f $MG_DIR/${TOOL_FILE_NAME_TGZ} ]; then
|
||||
wget --no-check-certificate -O $MG_DIR/${TOOL_FILE_NAME_TGZ} https://fastdl.mongodb.org/tools/db/${TOOL_FILE_NAME_TGZ}
|
||||
fi
|
||||
|
||||
@@ -0,0 +1,107 @@
|
||||
#!/bin/bash
|
||||
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin:/opt/homebrew/bin
|
||||
export PATH
|
||||
|
||||
curPath=`pwd`
|
||||
rootPath=$(dirname "$curPath")
|
||||
rootPath=$(dirname "$rootPath")
|
||||
rootPath=$(dirname "$rootPath")
|
||||
serverPath=$(dirname "$rootPath")
|
||||
|
||||
VERSION=8.2.3
|
||||
SYS_ARCH=`arch`
|
||||
|
||||
SYS_VERSION_ID=`cat /etc/*-release | grep VERSION_ID | awk -F = '{print $2}' | awk -F "\"" '{print $2}'`
|
||||
SYS_NAME=${SYS_VERSION_ID/./}
|
||||
SYS_NAME_LEN=`echo "$SYS_NAME" | wc -L`
|
||||
|
||||
if [ "$SYS_NAME_LEN" == "1" ];then
|
||||
SYS_NAME=${SYS_NAME}0
|
||||
fi
|
||||
|
||||
if [ "$SYS_ARCH" == "aarch64" ];then
|
||||
if [ "$SYS_NAME" -gt "90" ];then
|
||||
SYS_NAME="90"
|
||||
fi
|
||||
|
||||
if [ "$SYS_NAME" -lt "82" ];then
|
||||
SYS_NAME="82"
|
||||
fi
|
||||
else
|
||||
|
||||
if [ "$SYS_NAME" -gt "90" ];then
|
||||
SYS_NAME="90"
|
||||
fi
|
||||
|
||||
if [ "$SYS_NAME" -lt "70" ];then
|
||||
SYS_NAME="70"
|
||||
fi
|
||||
fi
|
||||
|
||||
MG_DIR=$serverPath/source/mongodb
|
||||
mkdir -p $MG_DIR
|
||||
|
||||
FILE_NAME=mongodb-linux-${SYS_ARCH}-rhel${SYS_NAME}-${VERSION}
|
||||
FILE_NAME_TGZ=${FILE_NAME}.tgz
|
||||
|
||||
if [ ! -f $MG_DIR/${FILE_NAME_TGZ} ]; then
|
||||
wget --no-check-certificate -O $MG_DIR/${FILE_NAME_TGZ} https://fastdl.mongodb.org/linux/${FILE_NAME_TGZ}
|
||||
echo "wget --no-check-certificate -O $MG_DIR/${FILE_NAME_TGZ} https://fastdl.mongodb.org/linux/${FILE_NAME_TGZ}"
|
||||
fi
|
||||
|
||||
if [ ! -d $MG_DIR/${FILE_NAME} ];then
|
||||
cd $MG_DIR && tar -zxvf ${FILE_NAME_TGZ}
|
||||
fi
|
||||
|
||||
if [ ! -d $serverPath/mongodb/bin ];then
|
||||
mkdir -p $serverPath/mongodb
|
||||
cd $MG_DIR/${FILE_NAME} && cp -rf ./bin $serverPath/mongodb
|
||||
fi
|
||||
|
||||
cd ${MG_DIR} && rm -rf ${MG_DIR}/${FILE_NAME}
|
||||
|
||||
#--------------- mongosh tool install ------------------ #
|
||||
TOOL_VERSION=2.2.5
|
||||
TOOL_FILE_NAME=mongosh-${TOOL_VERSION}-linux-x64
|
||||
if [ "aarch64" == ${SYS_ARCH} ];then
|
||||
TOOL_FILE_NAME=mongosh-${TOOL_VERSION}-linux-arm64
|
||||
fi
|
||||
TOOL_FILE_NAME_TGZ=${TOOL_FILE_NAME}.tgz
|
||||
if [ ! -f $MG_DIR/${TOOL_FILE_NAME_TGZ} ]; then
|
||||
wget --no-check-certificate -O $MG_DIR/${TOOL_FILE_NAME_TGZ} https://downloads.mongodb.com/compass/${TOOL_FILE_NAME_TGZ}
|
||||
echo "wget --no-check-certificate -O $MG_DIR/${TOOL_FILE_NAME_TGZ} https://downloads.mongodb.com/compass/${TOOL_FILE_NAME_TGZ}"
|
||||
fi
|
||||
|
||||
if [ ! -d $MG_DIR/${TOOL_FILE_NAME_TGZ} ];then
|
||||
cd $MG_DIR && tar -zxvf ${TOOL_FILE_NAME_TGZ}
|
||||
fi
|
||||
|
||||
cd ${MG_DIR}/${TOOL_FILE_NAME} && cp -rf ./bin $serverPath/mongodb
|
||||
cd ${MG_DIR} && rm -rf ${MG_DIR}/${TOOL_FILE_NAME}
|
||||
|
||||
# https://fastdl.mongodb.org/tools/db/mongodb-database-tools-rhel90-aarch64-100.9.4.tgz
|
||||
# https://fastdl.mongodb.org/tools/db/mongodb-database-tools-rhel90-x86_64-100.9.4.tgz
|
||||
# https://fastdl.mongodb.org/tools/db/mongodb-database-tools-rhel83-s390x-100.9.4.tgz
|
||||
#--------------- mongodb database install ------------------ #
|
||||
TOOL_VERSION=100.9.4
|
||||
TOOL_FILE_NAME=mongodb-database-tools-rhel${SYS_NAME}-x86_64-${TOOL_VERSION}
|
||||
if [ "aarch64" == ${SYS_ARCH} ];then
|
||||
TOOL_FILE_NAME=mongodb-database-tools-rhel${SYS_NAME}-aarch64-${TOOL_VERSION}
|
||||
fi
|
||||
|
||||
if [ "arm64" == ${SYS_ARCH} ];then
|
||||
TOOL_FILE_NAME=mongodb-database-tools-rhel${SYS_NAME}-arm64-${TOOL_VERSION}
|
||||
fi
|
||||
|
||||
TOOL_FILE_NAME_TGZ=${TOOL_FILE_NAME}.tgz
|
||||
if [ ! -f $MG_DIR/${TOOL_FILE_NAME_TGZ} ]; then
|
||||
wget --no-check-certificate -O $MG_DIR/${TOOL_FILE_NAME_TGZ} https://fastdl.mongodb.org/tools/db/${TOOL_FILE_NAME_TGZ}
|
||||
fi
|
||||
|
||||
if [ ! -d $MG_DIR/${TOOL_FILE_NAME_TGZ} ];then
|
||||
cd $MG_DIR && tar -zxvf ${TOOL_FILE_NAME_TGZ}
|
||||
fi
|
||||
|
||||
cd ${MG_DIR}/${TOOL_FILE_NAME} && cp -rf ./bin $serverPath/mongodb
|
||||
cd ${MG_DIR} && rm -rf ${MG_DIR}/${TOOL_FILE_NAME}
|
||||
|
||||
@@ -0,0 +1,84 @@
|
||||
#!/bin/bash
|
||||
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin:/opt/homebrew/bin
|
||||
export PATH
|
||||
|
||||
curPath=`pwd`
|
||||
rootPath=$(dirname "$curPath")
|
||||
rootPath=$(dirname "$rootPath")
|
||||
rootPath=$(dirname "$rootPath")
|
||||
serverPath=$(dirname "$rootPath")
|
||||
|
||||
VERSION=8.2.3
|
||||
SYS_ARCH=`arch`
|
||||
SYS_VERSION_ID=`cat /etc/*-release | grep VERSION_ID | awk -F = '{print $2}' | awk -F "\"" '{print $2}'`
|
||||
SYS_NAME=${SYS_VERSION_ID/./}
|
||||
|
||||
|
||||
SYS_NAME="12"
|
||||
FILE_NAME=mongodb-linux-${SYS_ARCH}-debian${SYS_NAME}-${VERSION}
|
||||
FILE_NAME_TGZ=${FILE_NAME}.tgz
|
||||
|
||||
|
||||
MG_DIR=$serverPath/source/mongodb
|
||||
mkdir -p $MG_DIR
|
||||
|
||||
if [ ! -f $MG_DIR/${FILE_NAME_TGZ} ]; then
|
||||
wget --no-check-certificate -O $MG_DIR/${FILE_NAME_TGZ} https://fastdl.mongodb.org/linux/${FILE_NAME_TGZ}
|
||||
echo "wget --no-check-certificate -O $MG_DIR/${FILE_NAME_TGZ} https://fastdl.mongodb.org/linux/${FILE_NAME_TGZ}"
|
||||
fi
|
||||
|
||||
if [ ! -d $MG_DIR/${FILE_NAME_TGZ} ];then
|
||||
cd $MG_DIR && tar -zxvf ${FILE_NAME_TGZ}
|
||||
fi
|
||||
|
||||
if [ ! -d $serverPath/mongodb/bin ];then
|
||||
mkdir -p $serverPath/mongodb
|
||||
cd $MG_DIR/${FILE_NAME} && cp -rf ./bin $serverPath/mongodb
|
||||
fi
|
||||
|
||||
cd ${MG_DIR} && rm -rf ${MG_DIR}/${FILE_NAME}
|
||||
|
||||
|
||||
#--------------- mongosh tool install ------------------ #
|
||||
TOOL_VERSION=2.2.5
|
||||
TOOL_FILE_NAME=mongosh-${TOOL_VERSION}-linux-x64
|
||||
if [ "aarch64" == ${SYS_ARCH} ];then
|
||||
TOOL_FILE_NAME=mongosh-${TOOL_VERSION}-linux-arm64
|
||||
fi
|
||||
TOOL_FILE_NAME_TGZ=${TOOL_FILE_NAME}.tgz
|
||||
if [ ! -f $MG_DIR/${TOOL_FILE_NAME_TGZ} ]; then
|
||||
wget --no-check-certificate -O $MG_DIR/${TOOL_FILE_NAME_TGZ} https://downloads.mongodb.com/compass/${TOOL_FILE_NAME_TGZ}
|
||||
echo "wget --no-check-certificate -O $MG_DIR/${TOOL_FILE_NAME_TGZ} https://downloads.mongodb.com/compass/${TOOL_FILE_NAME_TGZ}"
|
||||
fi
|
||||
|
||||
if [ ! -d $MG_DIR/${TOOL_FILE_NAME_TGZ} ];then
|
||||
cd $MG_DIR && tar -zxvf ${TOOL_FILE_NAME_TGZ}
|
||||
fi
|
||||
|
||||
cd ${MG_DIR}/${TOOL_FILE_NAME} && cp -rf ./bin $serverPath/mongodb
|
||||
cd ${MG_DIR} && rm -rf ${MG_DIR}/${TOOL_FILE_NAME}
|
||||
|
||||
|
||||
#--------------- mongodb database install ------------------ #
|
||||
TOOL_VERSION=100.9.4
|
||||
TOOL_FILE_NAME=mongodb-database-tools-debian${SYS_NAME}-x86_64-${TOOL_VERSION}
|
||||
if [ "aarch64" == ${SYS_ARCH} ];then
|
||||
TOOL_FILE_NAME=mongodb-database-tools-debian${SYS_NAME}-arm64-${TOOL_VERSION}
|
||||
fi
|
||||
|
||||
if [ "arm64" == ${SYS_ARCH} ];then
|
||||
TOOL_FILE_NAME=mongodb-database-tools-debian${SYS_NAME}-arm64-${TOOL_VERSION}
|
||||
fi
|
||||
|
||||
TOOL_FILE_NAME_TGZ=${TOOL_FILE_NAME}.tgz
|
||||
if [ ! -f $MG_DIR/${TOOL_FILE_NAME_TGZ} ]; then
|
||||
wget --no-check-certificate -O $MG_DIR/${TOOL_FILE_NAME_TGZ} https://fastdl.mongodb.org/tools/db/${TOOL_FILE_NAME_TGZ}
|
||||
fi
|
||||
|
||||
if [ ! -d $MG_DIR/${TOOL_FILE_NAME_TGZ} ];then
|
||||
cd $MG_DIR && tar -zxvf ${TOOL_FILE_NAME_TGZ}
|
||||
fi
|
||||
|
||||
cd ${MG_DIR}/${TOOL_FILE_NAME} && cp -rf ./bin $serverPath/mongodb
|
||||
cd ${MG_DIR} && rm -rf ${MG_DIR}/${TOOL_FILE_NAME}
|
||||
|
||||
@@ -0,0 +1,107 @@
|
||||
#!/bin/bash
|
||||
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin:/opt/homebrew/bin
|
||||
export PATH
|
||||
|
||||
curPath=`pwd`
|
||||
rootPath=$(dirname "$curPath")
|
||||
rootPath=$(dirname "$rootPath")
|
||||
rootPath=$(dirname "$rootPath")
|
||||
serverPath=$(dirname "$rootPath")
|
||||
|
||||
VERSION=8.2.3
|
||||
SYS_ARCH=`arch`
|
||||
|
||||
SYS_VERSION_ID=`cat /etc/*-release | grep VERSION_ID | awk -F = '{print $2}' | awk -F "\"" '{print $2}'`
|
||||
SYS_NAME=${SYS_VERSION_ID/./}
|
||||
SYS_NAME_LEN=`echo "$SYS_NAME" | wc -L`
|
||||
|
||||
if [ "$SYS_NAME_LEN" == "1" ];then
|
||||
SYS_NAME=${SYS_NAME}0
|
||||
fi
|
||||
|
||||
if [ "$SYS_ARCH" == "aarch64" ];then
|
||||
if [ "$SYS_NAME" -gt "90" ];then
|
||||
SYS_NAME="90"
|
||||
fi
|
||||
|
||||
if [ "$SYS_NAME" -lt "82" ];then
|
||||
SYS_NAME="82"
|
||||
fi
|
||||
else
|
||||
|
||||
if [ "$SYS_NAME" -gt "90" ];then
|
||||
SYS_NAME="90"
|
||||
fi
|
||||
|
||||
if [ "$SYS_NAME" -lt "70" ];then
|
||||
SYS_NAME="70"
|
||||
fi
|
||||
fi
|
||||
|
||||
MG_DIR=$serverPath/source/mongodb
|
||||
mkdir -p $MG_DIR
|
||||
|
||||
FILE_NAME=mongodb-linux-${SYS_ARCH}-rhel${SYS_NAME}-${VERSION}
|
||||
FILE_NAME_TGZ=${FILE_NAME}.tgz
|
||||
|
||||
if [ ! -f $MG_DIR/${FILE_NAME_TGZ} ]; then
|
||||
wget --no-check-certificate -O $MG_DIR/${FILE_NAME_TGZ} https://fastdl.mongodb.org/linux/${FILE_NAME_TGZ}
|
||||
echo "wget --no-check-certificate -O $MG_DIR/${FILE_NAME_TGZ} https://fastdl.mongodb.org/linux/${FILE_NAME_TGZ}"
|
||||
fi
|
||||
|
||||
if [ ! -d $MG_DIR/${FILE_NAME} ];then
|
||||
cd $MG_DIR && tar -zxvf ${FILE_NAME_TGZ}
|
||||
fi
|
||||
|
||||
if [ ! -d $serverPath/mongodb/bin ];then
|
||||
mkdir -p $serverPath/mongodb
|
||||
cd $MG_DIR/${FILE_NAME} && cp -rf ./bin $serverPath/mongodb
|
||||
fi
|
||||
|
||||
cd ${MG_DIR} && rm -rf ${MG_DIR}/${FILE_NAME}
|
||||
|
||||
#--------------- mongosh tool install ------------------ #
|
||||
TOOL_VERSION=2.2.5
|
||||
TOOL_FILE_NAME=mongosh-${TOOL_VERSION}-linux-x64
|
||||
if [ "aarch64" == ${SYS_ARCH} ];then
|
||||
TOOL_FILE_NAME=mongosh-${TOOL_VERSION}-linux-arm64
|
||||
fi
|
||||
TOOL_FILE_NAME_TGZ=${TOOL_FILE_NAME}.tgz
|
||||
if [ ! -f $MG_DIR/${TOOL_FILE_NAME_TGZ} ]; then
|
||||
wget --no-check-certificate -O $MG_DIR/${TOOL_FILE_NAME_TGZ} https://downloads.mongodb.com/compass/${TOOL_FILE_NAME_TGZ}
|
||||
echo "wget --no-check-certificate -O $MG_DIR/${TOOL_FILE_NAME_TGZ} https://downloads.mongodb.com/compass/${TOOL_FILE_NAME_TGZ}"
|
||||
fi
|
||||
|
||||
if [ ! -d $MG_DIR/${TOOL_FILE_NAME_TGZ} ];then
|
||||
cd $MG_DIR && tar -zxvf ${TOOL_FILE_NAME_TGZ}
|
||||
fi
|
||||
|
||||
cd ${MG_DIR}/${TOOL_FILE_NAME} && cp -rf ./bin $serverPath/mongodb
|
||||
cd ${MG_DIR} && rm -rf ${MG_DIR}/${TOOL_FILE_NAME}
|
||||
|
||||
# https://fastdl.mongodb.org/tools/db/mongodb-database-tools-rhel90-aarch64-100.9.4.tgz
|
||||
# https://fastdl.mongodb.org/tools/db/mongodb-database-tools-rhel90-x86_64-100.9.4.tgz
|
||||
# https://fastdl.mongodb.org/tools/db/mongodb-database-tools-rhel83-s390x-100.9.4.tgz
|
||||
#--------------- mongodb database install ------------------ #
|
||||
TOOL_VERSION=100.9.4
|
||||
TOOL_FILE_NAME=mongodb-database-tools-rhel${SYS_NAME}-x86_64-${TOOL_VERSION}
|
||||
if [ "aarch64" == ${SYS_ARCH} ];then
|
||||
TOOL_FILE_NAME=mongodb-database-tools-rhel${SYS_NAME}-aarch64-${TOOL_VERSION}
|
||||
fi
|
||||
|
||||
if [ "arm64" == ${SYS_ARCH} ];then
|
||||
TOOL_FILE_NAME=mongodb-database-tools-rhel${SYS_NAME}-arm64-${TOOL_VERSION}
|
||||
fi
|
||||
|
||||
TOOL_FILE_NAME_TGZ=${TOOL_FILE_NAME}.tgz
|
||||
if [ ! -f $MG_DIR/${TOOL_FILE_NAME_TGZ} ]; then
|
||||
wget --no-check-certificate -O $MG_DIR/${TOOL_FILE_NAME_TGZ} https://fastdl.mongodb.org/tools/db/${TOOL_FILE_NAME_TGZ}
|
||||
fi
|
||||
|
||||
if [ ! -d $MG_DIR/${TOOL_FILE_NAME_TGZ} ];then
|
||||
cd $MG_DIR && tar -zxvf ${TOOL_FILE_NAME_TGZ}
|
||||
fi
|
||||
|
||||
cd ${MG_DIR}/${TOOL_FILE_NAME} && cp -rf ./bin $serverPath/mongodb
|
||||
cd ${MG_DIR} && rm -rf ${MG_DIR}/${TOOL_FILE_NAME}
|
||||
|
||||
@@ -0,0 +1,87 @@
|
||||
#!/bin/bash
|
||||
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin:/opt/homebrew/bin
|
||||
export PATH
|
||||
|
||||
curPath=`pwd`
|
||||
rootPath=$(dirname "$curPath")
|
||||
rootPath=$(dirname "$rootPath")
|
||||
rootPath=$(dirname "$rootPath")
|
||||
serverPath=$(dirname "$rootPath")
|
||||
SYS_ARCH=`arch`
|
||||
|
||||
VERSION=8.2.3
|
||||
|
||||
MG_DIR=$serverPath/source/mongodb
|
||||
mkdir -p $MG_DIR
|
||||
|
||||
# https://fastdl.mongodb.org/osx/mongodb-macos-arm64-8.0.3.tgz
|
||||
FILE_NAME=mongodb-macos-x86_64-${VERSION}
|
||||
if [ "arm64" == "${SYS_ARCH}" ];then
|
||||
FILE_NAME=mongodb-macos-arm64-${VERSION}
|
||||
fi
|
||||
FILE_NAME_TGZ=${FILE_NAME}.tgz
|
||||
|
||||
if [ ! -f $MG_DIR/${FILE_NAME_TGZ} ]; then
|
||||
wget --no-check-certificate -O $MG_DIR/${FILE_NAME_TGZ} https://fastdl.mongodb.org/osx/${FILE_NAME_TGZ}
|
||||
echo "wget --no-check-certificate -O $MG_DIR/${FILE_NAME_TGZ} https://fastdl.mongodb.org/osx/${FILE_NAME_TGZ}"
|
||||
fi
|
||||
|
||||
if [ ! -d $MG_DIR/${FILE_NAME} ];then
|
||||
cd $MG_DIR && tar -zxvf ${FILE_NAME_TGZ}
|
||||
fi
|
||||
|
||||
if [ ! -d $serverPath/mongodb/bin ];then
|
||||
mkdir -p $serverPath/mongodb
|
||||
cd $MG_DIR/${FILE_NAME} && cp -rf ./bin $serverPath/mongodb
|
||||
fi
|
||||
|
||||
# https://downloads.mongodb.com/compass/mongosh-2.2.5-darwin-x64.zip
|
||||
# https://downloads.mongodb.com/compass/mongosh-2.2.5-darwin-arm64.zip
|
||||
#--------------- mongosh tool install ------------------ #
|
||||
TOOL_VERSION=2.2.5
|
||||
TOOL_FILE_NAME=mongosh-${TOOL_VERSION}-darwin-x64
|
||||
if [ "aarch64" == ${SYS_ARCH} ];then
|
||||
TOOL_FILE_NAME=mongosh-${TOOL_VERSION}-darwin-arm64
|
||||
fi
|
||||
|
||||
if [ "arm64" == ${SYS_ARCH} ];then
|
||||
TOOL_FILE_NAME=mongosh-${TOOL_VERSION}-darwin-arm64
|
||||
fi
|
||||
TOOL_FILE_NAME_TGZ=${TOOL_FILE_NAME}.zip
|
||||
if [ ! -f $MG_DIR/${TOOL_FILE_NAME_TGZ} ]; then
|
||||
wget --no-check-certificate -O $MG_DIR/${TOOL_FILE_NAME_TGZ} https://downloads.mongodb.com/compass/${TOOL_FILE_NAME_TGZ}
|
||||
echo "wget --no-check-certificate -O $MG_DIR/${TOOL_FILE_NAME_TGZ} https://downloads.mongodb.com/compass/${TOOL_FILE_NAME_TGZ}"
|
||||
fi
|
||||
|
||||
if [ ! -d $MG_DIR/${TOOL_FILE_NAME_TGZ} ];then
|
||||
cd $MG_DIR && unzip ${TOOL_FILE_NAME_TGZ}
|
||||
fi
|
||||
|
||||
cd ${MG_DIR}/${TOOL_FILE_NAME} && cp -rf ./bin $serverPath/mongodb
|
||||
cd ${MG_DIR} && rm -rf ${MG_DIR}/${TOOL_FILE_NAME}
|
||||
|
||||
|
||||
|
||||
# https://fastdl.mongodb.org/tools/db/mongodb-database-tools-macos-arm64-100.9.4.zip
|
||||
TOOL_VERSION=100.9.4
|
||||
TOOL_FILE_NAME=mongodb-database-tools-macos-x86_64-${TOOL_VERSION}
|
||||
if [ "aarch64" == ${SYS_ARCH} ];then
|
||||
TOOL_FILE_NAME=mongodb-database-tools-macos-arm64-${TOOL_VERSION}
|
||||
fi
|
||||
|
||||
if [ "arm64" == ${SYS_ARCH} ];then
|
||||
TOOL_FILE_NAME=mongodb-database-tools-macos-arm64-${TOOL_VERSION}
|
||||
fi
|
||||
|
||||
TOOL_FILE_NAME_TGZ=${TOOL_FILE_NAME}.zip
|
||||
if [ ! -f $MG_DIR/${TOOL_FILE_NAME_TGZ} ]; then
|
||||
wget --no-check-certificate -O $MG_DIR/${TOOL_FILE_NAME_TGZ} https://fastdl.mongodb.org/tools/db/${TOOL_FILE_NAME_TGZ}
|
||||
echo "wget --no-check-certificate -O $MG_DIR/${TOOL_FILE_NAME_TGZ} https://fastdl.mongodb.org/tools/db/${TOOL_FILE_NAME_TGZ}"
|
||||
fi
|
||||
|
||||
if [ ! -d $MG_DIR/${TOOL_FILE_NAME_TGZ} ];then
|
||||
cd $MG_DIR && unzip ${TOOL_FILE_NAME_TGZ}
|
||||
fi
|
||||
|
||||
cd ${MG_DIR}/${TOOL_FILE_NAME} && cp -rf ./bin $serverPath/mongodb
|
||||
cd ${MG_DIR} && rm -rf ${MG_DIR}/${TOOL_FILE_NAME}
|
||||
@@ -0,0 +1,94 @@
|
||||
#!/bin/bash
|
||||
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin:/opt/homebrew/bin
|
||||
export PATH
|
||||
|
||||
curPath=`pwd`
|
||||
rootPath=$(dirname "$curPath")
|
||||
rootPath=$(dirname "$rootPath")
|
||||
rootPath=$(dirname "$rootPath")
|
||||
serverPath=$(dirname "$rootPath")
|
||||
|
||||
VERSION=8.2.3
|
||||
SYS_ARCH=`arch`
|
||||
|
||||
SYS_VERSION_ID=`cat /etc/*-release | grep VERSION_ID | awk -F = '{print $2}' | awk -F "\"" '{print $2}' | awk -F . '{print $1}'`
|
||||
|
||||
SYS_NAME="15"
|
||||
if [ "$SYS_VERSION_ID" -gt "15" ];then
|
||||
SYS_NAME="15"
|
||||
fi
|
||||
|
||||
if [ "$SYS_NAME" -lt "12" ];then
|
||||
SYS_NAME="12"
|
||||
fi
|
||||
|
||||
# https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-suse15-4.4.23.tgz
|
||||
# https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-suse12-4.4.23.tgz
|
||||
|
||||
MG_DIR=$serverPath/source/mongodb
|
||||
mkdir -p $MG_DIR
|
||||
|
||||
FILE_NAME=mongodb-linux-${SYS_ARCH}-suse${SYS_NAME}-${VERSION}
|
||||
FILE_NAME_TGZ=${FILE_NAME}.tgz
|
||||
|
||||
if [ ! -f $MG_DIR/${FILE_NAME_TGZ} ]; then
|
||||
wget --no-check-certificate -O $MG_DIR/${FILE_NAME_TGZ} https://fastdl.mongodb.org/linux/${FILE_NAME_TGZ}
|
||||
echo "wget --no-check-certificate -O $MG_DIR/${FILE_NAME_TGZ} https://fastdl.mongodb.org/linux/${FILE_NAME_TGZ}"
|
||||
fi
|
||||
|
||||
if [ ! -d $MG_DIR/${FILE_NAME} ];then
|
||||
cd $MG_DIR && tar -zxvf ${FILE_NAME_TGZ}
|
||||
fi
|
||||
|
||||
if [ ! -d $serverPath/mongodb/bin ];then
|
||||
mkdir -p $serverPath/mongodb
|
||||
cd $MG_DIR/${FILE_NAME} && cp -rf ./bin $serverPath/mongodb
|
||||
fi
|
||||
|
||||
cd ${MG_DIR} && rm -rf ${MG_DIR}/${FILE_NAME}
|
||||
|
||||
|
||||
#--------------- mongosh tool install ------------------ #
|
||||
TOOL_VERSION=2.2.5
|
||||
TOOL_FILE_NAME=mongosh-${TOOL_VERSION}-linux-x64
|
||||
if [ "aarch64" == ${SYS_ARCH} ];then
|
||||
TOOL_FILE_NAME=mongosh-${TOOL_VERSION}-linux-arm64
|
||||
fi
|
||||
TOOL_FILE_NAME_TGZ=${TOOL_FILE_NAME}.tgz
|
||||
if [ ! -f $MG_DIR/${TOOL_FILE_NAME_TGZ} ]; then
|
||||
wget --no-check-certificate -O $MG_DIR/${TOOL_FILE_NAME_TGZ} https://downloads.mongodb.com/compass/${TOOL_FILE_NAME_TGZ}
|
||||
echo "wget --no-check-certificate -O $MG_DIR/${TOOL_FILE_NAME_TGZ} https://downloads.mongodb.com/compass/${TOOL_FILE_NAME_TGZ}"
|
||||
fi
|
||||
|
||||
if [ ! -d $MG_DIR/${TOOL_FILE_NAME_TGZ} ];then
|
||||
cd $MG_DIR && tar -zxvf ${TOOL_FILE_NAME_TGZ}
|
||||
fi
|
||||
|
||||
cd ${MG_DIR}/${TOOL_FILE_NAME} && cp -rf ./bin $serverPath/mongodb
|
||||
cd ${MG_DIR} && rm -rf ${MG_DIR}/${TOOL_FILE_NAME}
|
||||
|
||||
|
||||
# https://fastdl.mongodb.org/tools/db/mongodb-database-tools-suse12-x86_64-100.9.4.tgz
|
||||
#--------------- mongodb database install ------------------ #
|
||||
TOOL_VERSION=100.9.4
|
||||
TOOL_FILE_NAME=mongodb-database-tools-suse${SYS_NAME}-x86_64-${TOOL_VERSION}
|
||||
if [ "aarch64" == ${SYS_ARCH} ];then
|
||||
TOOL_FILE_NAME=mongodb-database-tools-suse${SYS_NAME}-arm64-${TOOL_VERSION}
|
||||
fi
|
||||
|
||||
if [ "arm64" == ${SYS_ARCH} ];then
|
||||
TOOL_FILE_NAME=mongodb-database-tools-suse${SYS_NAME}-arm64-${TOOL_VERSION}
|
||||
fi
|
||||
|
||||
TOOL_FILE_NAME_TGZ=${TOOL_FILE_NAME}.tgz
|
||||
if [ ! -f $MG_DIR/${TOOL_FILE_NAME_TGZ} ]; then
|
||||
wget --no-check-certificate -O $MG_DIR/${TOOL_FILE_NAME_TGZ} https://fastdl.mongodb.org/tools/db/${TOOL_FILE_NAME_TGZ}
|
||||
fi
|
||||
|
||||
if [ ! -d $MG_DIR/${TOOL_FILE_NAME_TGZ} ];then
|
||||
cd $MG_DIR && tar -zxvf ${TOOL_FILE_NAME_TGZ}
|
||||
fi
|
||||
|
||||
cd ${MG_DIR}/${TOOL_FILE_NAME} && cp -rf ./bin $serverPath/mongodb
|
||||
cd ${MG_DIR} && rm -rf ${MG_DIR}/${TOOL_FILE_NAME}
|
||||
|
||||
@@ -0,0 +1,94 @@
|
||||
#!/bin/bash
|
||||
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin:/opt/homebrew/bin
|
||||
export PATH
|
||||
|
||||
curPath=`pwd`
|
||||
rootPath=$(dirname "$curPath")
|
||||
rootPath=$(dirname "$rootPath")
|
||||
rootPath=$(dirname "$rootPath")
|
||||
serverPath=$(dirname "$rootPath")
|
||||
|
||||
VERSION=8.2.3
|
||||
SYS_ARCH=`arch`
|
||||
|
||||
SYS_VERSION_ID=`cat /etc/*-release | grep VERSION_ID | awk -F = '{print $2}' | awk -F "\"" '{print $2}'`
|
||||
SYS_NAME=${SYS_VERSION_ID/./}
|
||||
# https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu2004-4.4.23.tgz
|
||||
|
||||
if [ "$SYS_NAME" -lt "2004" ];then
|
||||
SYS_NAME="2004"
|
||||
fi
|
||||
|
||||
if [ "$SYS_NAME" == "2204" ];then
|
||||
SYS_NAME="2204"
|
||||
fi
|
||||
|
||||
if [ "$SYS_NAME" == "2404" ];then
|
||||
SYS_NAME="2404"
|
||||
fi
|
||||
|
||||
MG_DIR=$serverPath/source/mongodb
|
||||
mkdir -p $MG_DIR
|
||||
|
||||
FILE_NAME=mongodb-linux-${SYS_ARCH}-ubuntu${SYS_NAME}-${VERSION}
|
||||
FILE_NAME_TGZ=${FILE_NAME}.tgz
|
||||
|
||||
if [ ! -f $MG_DIR/${FILE_NAME_TGZ} ]; then
|
||||
wget --no-check-certificate -O $MG_DIR/${FILE_NAME_TGZ} https://fastdl.mongodb.org/linux/${FILE_NAME_TGZ}
|
||||
echo "wget --no-check-certificate -O $MG_DIR/${FILE_NAME_TGZ} https://fastdl.mongodb.org/linux/${FILE_NAME_TGZ}"
|
||||
fi
|
||||
|
||||
if [ ! -d $MG_DIR/${FILE_NAME} ];then
|
||||
cd $MG_DIR && tar -zxvf ${FILE_NAME_TGZ}
|
||||
fi
|
||||
|
||||
if [ ! -d $serverPath/mongodb/bin ];then
|
||||
mkdir -p $serverPath/mongodb
|
||||
cd $MG_DIR/${FILE_NAME} && cp -rf ./bin $serverPath/mongodb
|
||||
fi
|
||||
|
||||
cd ${MG_DIR} && rm -rf ${MG_DIR}/${FILE_NAME}
|
||||
|
||||
|
||||
#--------------- mongosh tool install ------------------ #
|
||||
TOOL_VERSION=2.2.5
|
||||
TOOL_FILE_NAME=mongosh-${TOOL_VERSION}-linux-x64
|
||||
if [ "aarch64" == ${SYS_ARCH} ];then
|
||||
TOOL_FILE_NAME=mongosh-${TOOL_VERSION}-linux-arm64
|
||||
fi
|
||||
TOOL_FILE_NAME_TGZ=${TOOL_FILE_NAME}.tgz
|
||||
if [ ! -f $MG_DIR/${TOOL_FILE_NAME_TGZ} ]; then
|
||||
wget --no-check-certificate -O $MG_DIR/${TOOL_FILE_NAME_TGZ} https://downloads.mongodb.com/compass/${TOOL_FILE_NAME_TGZ}
|
||||
echo "wget --no-check-certificate -O $MG_DIR/${TOOL_FILE_NAME_TGZ} https://downloads.mongodb.com/compass/${TOOL_FILE_NAME_TGZ}"
|
||||
fi
|
||||
|
||||
if [ ! -d $MG_DIR/${TOOL_FILE_NAME_TGZ} ];then
|
||||
cd $MG_DIR && tar -zxvf ${TOOL_FILE_NAME_TGZ}
|
||||
fi
|
||||
|
||||
cd ${MG_DIR}/${TOOL_FILE_NAME} && cp -rf ./bin $serverPath/mongodb
|
||||
cd ${MG_DIR} && rm -rf ${MG_DIR}/${TOOL_FILE_NAME}
|
||||
|
||||
# https://fastdl.mongodb.org/tools/db/mongodb-database-tools-ubuntu2204-x86_64-100.9.4.tgz
|
||||
#--------------- mongodb database install ------------------ #
|
||||
TOOL_VERSION=100.9.4
|
||||
TOOL_FILE_NAME=mongodb-database-tools-ubuntu${SYS_NAME}-x86_64-${TOOL_VERSION}
|
||||
if [ "aarch64" == ${SYS_ARCH} ];then
|
||||
TOOL_FILE_NAME=mongodb-database-tools-ubuntu${SYS_NAME}-arm64-${TOOL_VERSION}
|
||||
fi
|
||||
|
||||
if [ "arm64" == ${SYS_ARCH} ];then
|
||||
TOOL_FILE_NAME=mongodb-database-tools-ubuntu${SYS_NAME}-arm64-${TOOL_VERSION}
|
||||
fi
|
||||
|
||||
TOOL_FILE_NAME_TGZ=${TOOL_FILE_NAME}.tgz
|
||||
if [ ! -f $MG_DIR/${TOOL_FILE_NAME_TGZ} ]; then
|
||||
wget --no-check-certificate -O $MG_DIR/${TOOL_FILE_NAME_TGZ} https://fastdl.mongodb.org/tools/db/${TOOL_FILE_NAME_TGZ}
|
||||
fi
|
||||
|
||||
if [ ! -d $MG_DIR/${TOOL_FILE_NAME_TGZ} ];then
|
||||
cd $MG_DIR && tar -zxvf ${TOOL_FILE_NAME_TGZ}
|
||||
fi
|
||||
|
||||
cd ${MG_DIR}/${TOOL_FILE_NAME} && cp -rf ./bin $serverPath/mongodb
|
||||
cd ${MG_DIR} && rm -rf ${MG_DIR}/${TOOL_FILE_NAME}
|
||||
@@ -78,7 +78,7 @@ def getArgs():
|
||||
|
||||
def status():
|
||||
data = mw.execShell(
|
||||
"ps aux|grep mosquitto |grep -v grep | grep -v python | grep -v mdserver-web | awk '{print $2}'")
|
||||
"ps -ef|grep mosquitto |grep -v grep | grep -v python | grep -v mdserver-web | awk '{print $2}'")
|
||||
|
||||
if data[0] == '':
|
||||
return 'stop'
|
||||
|
||||
@@ -57,7 +57,7 @@ app_start(){
|
||||
|
||||
app_stop(){
|
||||
echo -e "stopping mosquitto ... \c";
|
||||
arr=`ps aux | grep 'mosquitto' | grep -v grep | awk '{print $2}'`
|
||||
arr=`ps -ef | grep 'mosquitto' | grep -v grep | awk '{print $2}'`
|
||||
for p in ${arr[@]}
|
||||
do
|
||||
kill -9 $p > /dev/null 2>&1
|
||||
|
||||
@@ -25,14 +25,25 @@ sysName=$(uname | tr '[:upper:]' '[:lower:]')
|
||||
|
||||
ARCH=amd64
|
||||
get_arch() {
|
||||
echo "package main
|
||||
import (
|
||||
\"fmt\"
|
||||
\"runtime\"
|
||||
)
|
||||
func main() { fmt.Println(runtime.GOARCH) }" > /tmp/go_arch.go
|
||||
|
||||
ARCH=$(go run /tmp/go_arch.go)
|
||||
# 使用 bash 来识别架构
|
||||
local arch=$(uname -m)
|
||||
case $arch in
|
||||
x86_64|amd64)
|
||||
ARCH=amd64
|
||||
;;
|
||||
aarch64|arm64)
|
||||
ARCH=arm64
|
||||
;;
|
||||
armv7l|armv7)
|
||||
ARCH=armv7
|
||||
;;
|
||||
i686|i386)
|
||||
ARCH=386
|
||||
;;
|
||||
*)
|
||||
ARCH=amd64
|
||||
;;
|
||||
esac
|
||||
echo "ARCH:${ARCH}"
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,106 @@
|
||||
[client]
|
||||
user = root
|
||||
#password = your_password
|
||||
port = 33206
|
||||
socket = {$SERVER_APP_PATH}/mysql.sock
|
||||
default-character-set = UTF8MB4
|
||||
|
||||
[mysqld]
|
||||
!include {$SERVER_APP_PATH}/etc/mode/classic.cnf
|
||||
|
||||
authentication_policy=caching_sha2_password
|
||||
pid-file = {$SERVER_APP_PATH}/data/mysql.pid
|
||||
user = mysql
|
||||
port = 33206
|
||||
mysqlx_port = 33260
|
||||
socket = {$SERVER_APP_PATH}/mysql.sock
|
||||
datadir = {$SERVER_APP_PATH}/data
|
||||
log-error = {$SERVER_APP_PATH}/data/error.log
|
||||
server-id = {$SERVER_ID}
|
||||
|
||||
default_storage_engine = InnoDB
|
||||
|
||||
key_buffer_size = 8M
|
||||
table_open_cache = 32
|
||||
sort_buffer_size = 256K
|
||||
net_buffer_length = 4K
|
||||
read_buffer_size = 128K
|
||||
read_rnd_buffer_size = 256K
|
||||
myisam_sort_buffer_size = 4M
|
||||
thread_cache_size = 4
|
||||
lower_case_table_names=1
|
||||
tmp_table_size = 8M
|
||||
character-set-server = UTF8MB4
|
||||
|
||||
max_connections = 500
|
||||
max_connect_errors = 100
|
||||
open_files_limit = 2560
|
||||
max_allowed_packet = 128M
|
||||
|
||||
#skip-external-locking
|
||||
#skip-grant-tables
|
||||
#loose-skip-innodb
|
||||
#skip-networking
|
||||
#skip-name-resolve
|
||||
|
||||
#skip-log-bin
|
||||
#disable-log-bin
|
||||
#skip-slave-start
|
||||
log-bin=mysql-bin
|
||||
slow_query_log=1
|
||||
slow-query-log-file={$SERVER_APP_PATH}/data/mysql-slow.log
|
||||
long_query_time=3
|
||||
#log_queries_not_using_indexes=on
|
||||
|
||||
relay-log=mdserver
|
||||
relay-log-index=mdserver
|
||||
|
||||
#master
|
||||
#sync_binlog=1
|
||||
|
||||
#binlog-do-db
|
||||
binlog-ignore-db = test
|
||||
binlog-ignore-db = mysql
|
||||
binlog-ignore-db = information_schema
|
||||
binlog-ignore-db = performance_schema
|
||||
|
||||
#slave
|
||||
log_replica_updates
|
||||
#replicate-do-db
|
||||
replica_skip_errors=1062,1396
|
||||
replicate-ignore-db = information_schema
|
||||
replicate-ignore-db = performance_schema
|
||||
replicate-ignore-db = mysql
|
||||
replicate-ignore-db = test
|
||||
|
||||
default_storage_engine = InnoDB
|
||||
innodb_data_home_dir = {$SERVER_APP_PATH}/data
|
||||
innodb_data_file_path = ibdata1:10M:autoextend
|
||||
innodb_log_group_home_dir = {$SERVER_APP_PATH}/data
|
||||
innodb_buffer_pool_size = 16M
|
||||
innodb_redo_log_capacity = 4G
|
||||
innodb_log_buffer_size = 8M
|
||||
innodb_flush_log_at_trx_commit = 1
|
||||
innodb_lock_wait_timeout = 120
|
||||
innodb_max_dirty_pages_pct = 90
|
||||
innodb_read_io_threads = 1
|
||||
innodb_write_io_threads = 1
|
||||
innodb_file_per_table = 1
|
||||
binlog_expire_logs_seconds=604800
|
||||
|
||||
secure-file-priv={$SERVER_APP_PATH}/tmp
|
||||
|
||||
[mysqldump]
|
||||
quick
|
||||
|
||||
[mysql]
|
||||
no-auto-rehash
|
||||
|
||||
[myisamchk]
|
||||
key_buffer_size = 20M
|
||||
sort_buffer_size = 20M
|
||||
read_buffer = 2M
|
||||
write_buffer = 2M
|
||||
|
||||
[mysqlhotcopy]
|
||||
interactive-timeout
|
||||
@@ -415,7 +415,7 @@ def getShowLogFile():
|
||||
return tmp.groups()[0].strip()
|
||||
|
||||
def getMdb8Ver():
|
||||
return ['8.0','8.1','8.2','8.3','8.4','9.0','9.1',"9.2"]
|
||||
return ['8.0','8.1','8.2','8.3','8.4','9.0','9.1', '9.2', '9.3', '9.4']
|
||||
|
||||
def getSlaveName():
|
||||
mdb8 = getMdb8Ver()
|
||||
@@ -662,7 +662,7 @@ def setMyDbPos(version=''):
|
||||
mw.writeFile(myfile, mycnf)
|
||||
restart(version)
|
||||
|
||||
result = mw.execShell('ps aux|grep mysqld| grep -v grep|grep -v python')
|
||||
result = mw.execShell('ps -ef|grep mysqld| grep -v grep|grep -v python')
|
||||
if len(result[0]) > 10:
|
||||
mw.writeFile('data/datadir.pl', t_datadir)
|
||||
return mw.returnJson(True, '存储目录迁移成功!')
|
||||
@@ -2063,7 +2063,7 @@ def getMasterStatus(version=''):
|
||||
|
||||
return mw.returnJson(master_status, '设置成功', data)
|
||||
except Exception as e:
|
||||
return mw.returnJson(False, "数据库密码错误,在管理列表-点击【修复】!", 'pwd')
|
||||
return mw.returnJson(False, "数据库密码错误,在管理列表-点击【修复】!" + str(e) , 'pwd')
|
||||
|
||||
|
||||
def setMasterStatus(version=''):
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user