├── sshd.local ├── mc_log.sh ├── mc_backup.sh ├── pal_backup.sh ├── beifen.sh ├── pal_log.sh ├── PandoraNext ├── tokens.json └── config.json ├── fail2ban-nginx-cc.conf ├── valkey.conf ├── check_x86-64_psabi.sh ├── README.fa.md ├── Limiting_Shut_down.sh ├── TG-SSH-check-notify.sh ├── optimized_php.ini ├── custom_mysql_config-1.cnf ├── nginx.local ├── Limiting_Shut_down1.sh ├── README.tw.md ├── client_config ├── custom_mysql_config.cnf ├── README.kr.md ├── README.ja.md ├── archive.key ├── auto_cert_renewal-1.sh ├── CF-Under-Attack.sh ├── auto_cert_renewal.sh ├── ldnmp.sh ├── en └── to-en.py ├── ir └── to-fa.py ├── jp └── to-jp.py ├── kr └── to-kr.py ├── ru └── to-ru.py ├── tw └── to-tw.py ├── TG-check-notify.sh ├── cloudflare.conf ├── translate.py ├── upgrade_openssh9.8p1.sh ├── README.ru.md ├── README.md ├── .github └── workflows │ └── translate.yml ├── LICENSE ├── palworld.sh ├── mc.sh ├── update_log.sh ├── www-1.conf └── www.conf /sshd.local: -------------------------------------------------------------------------------- 1 | [sshd] 2 | 3 | enabled = true 4 | mode = normal 5 | backend = systemd 6 | -------------------------------------------------------------------------------- /mc_log.sh: -------------------------------------------------------------------------------- 1 | clear 2 | echo "脚本更新日志" 3 | echo "------------------------" 4 | echo "2025-11-16 v1.0.1" 5 | echo "Minecraft 开服脚本魔改自 幻兽帕鲁开服脚本" 6 | echo "2025-11-17 v1.0.1" 7 | ech "对 Minecraft 的难度等细节进行了适配" 8 | -------------------------------------------------------------------------------- /mc_backup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | clear 3 | mkdir -p /home/game 4 | docker cp mcserver:/data /home/game/mc 5 | cd /home/game/mc && tar czvf mc_$(date +"%Y%m%d%H%M%S").tar.gz mc 6 | rm -rf /home/game/mc/ 7 | echo -e "\033[0;32m游戏存档已导出存放在: /home/game/mc/\033[0m" 8 | -------------------------------------------------------------------------------- /pal_backup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | clear 3 | mkdir -p /home/game 4 | docker cp steamcmd:/home/steam/Steam/steamapps/common/PalServer/Pal/Saved/ /home/game/palworld/ 5 | cd /home/game && tar czvf palworld_$(date +"%Y%m%d%H%M%S").tar.gz palworld 6 | rm -rf /home/game/palworld/ 7 | echo -e "\033[0;32m游戏存档已导出存放在: /home/game/\033[0m" -------------------------------------------------------------------------------- /beifen.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Create a tar archive of the web directory 4 | cd /home/ && tar czvf web_$(date +"%Y%m%d%H%M%S").tar.gz web 5 | 6 | # Transfer the tar archive to another VPS 7 | cd /home/ && ls -t /home/*.tar.gz | head -1 | xargs -I {} sshpass -p 123456 scp -o StrictHostKeyChecking=no -P 22 {} root@0.0.0.0:/home/ 8 | 9 | # Keep only 5 tar archives and delete the rest 10 | cd /home/ && ls -t /home/*.tar.gz | tail -n +4 | xargs -I {} rm {} 11 | -------------------------------------------------------------------------------- /pal_log.sh: -------------------------------------------------------------------------------- 1 | clear 2 | echo "脚本更新日志" 3 | echo "------------------------" 4 | echo "2024-2-1 v1.0" 5 | echo "风靡全球的幻兽帕鲁服务端管理面板上线!" 6 | echo "------------------------" 7 | echo "2024-2-2 v1.0.1" 8 | echo "增加了游戏存档定时备份,可选每周,每天,每小时" 9 | echo "主菜单增加了游戏服务安装状态以及开服情况的智能显示" 10 | echo "主菜单增加k选项与科技lion官方脚本工具联动。" 11 | echo "主菜单增加游戏配置修改功能" 12 | echo "对脚本细节调优,体验更好" 13 | echo "------------------------" 14 | -------------------------------------------------------------------------------- /PandoraNext/tokens.json: -------------------------------------------------------------------------------- 1 | { 2 | "test-1": { 3 | "token": "access token / session token / refresh token", 4 | "shared": true, 5 | "show_user_info": false 6 | }, 7 | "test-2": { 8 | "token": "access token / session token / refresh token", 9 | "shared": true, 10 | "show_user_info": true, 11 | "plus": true 12 | }, 13 | "test2": { 14 | "token": "access token / session token / refresh token / share token / username & password", 15 | "password": "12345" 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /fail2ban-nginx-cc.conf: -------------------------------------------------------------------------------- 1 | [Definition] 2 | # failregex = ^ .* "(GET|POST|HEAD).*HTTP.*" (404|503) .*$ 3 | # failregex = ^ .* "(GET|POST|HEAD).*HTTP.*" (404|503|444) .* 4 | # failregex = ^ .* "(GET|POST|HEAD).*HTTP.*" (403|404|429) .* 5 | # failregex = ^ .* "(GET|POST|HEAD).*HTTP.*" ([45]\d\d) .* 6 | # ignoreregex =.*(robots.txt|favicon.ico|jpg|png) 7 | failregex = ^ .* HTTP.* (403|429) .*$ 8 | ignoreregex = ^.*(\/(?:robots\.txt|favicon\.ico|.*\.(?:jpg|png|gif|jpeg|svg|webp|bmp|tiff|css|js|woff|woff2|eot|ttf|otf))$) 9 | 10 | -------------------------------------------------------------------------------- /valkey.conf: -------------------------------------------------------------------------------- 1 | # 基础设置 2 | bind 0.0.0.0 3 | protected-mode yes 4 | port 6379 5 | timeout 300 6 | tcp-keepalive 300 7 | 8 | # 性能优化 9 | io-threads 4 10 | io-threads-do-reads yes 11 | databases 1 12 | maxclients 10000 13 | 14 | # 内存管理 15 | maxmemory 2gb 16 | maxmemory-policy allkeys-lru 17 | 18 | # 禁用持久化 19 | save "" 20 | appendonly no 21 | rdbcompression no 22 | rdbchecksum no 23 | 24 | # 日志设置 25 | loglevel warning 26 | logfile "" 27 | 28 | # 异步删除优化 29 | lazyfree-lazy-eviction yes 30 | lazyfree-lazy-expire yes 31 | lazyfree-lazy-server-del yes 32 | -------------------------------------------------------------------------------- /check_x86-64_psabi.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/awk -f 2 | 3 | BEGIN { 4 | while (!/flags/) if (getline < "/proc/cpuinfo" != 1) exit 1 5 | if (/lm/&&/cmov/&&/cx8/&&/fpu/&&/fxsr/&&/mmx/&&/syscall/&&/sse2/) level = 1 6 | if (level == 1 && /cx16/&&/lahf/&&/popcnt/&&/sse4_1/&&/sse4_2/&&/ssse3/) level = 2 7 | if (level == 2 && /avx/&&/avx2/&&/bmi1/&&/bmi2/&&/f16c/&&/fma/&&/abm/&&/movbe/&&/xsave/) level = 3 8 | if (level == 3 && /avx512f/&&/avx512bw/&&/avx512cd/&&/avx512dq/&&/avx512vl/) level = 3 9 | if (level > 0) { print "CPU supports x86-64-v" level; exit level + 1 } 10 | exit 1 11 | } 12 | -------------------------------------------------------------------------------- /README.fa.md: -------------------------------------------------------------------------------- 1 | ## 📜 معرفی (معرفی اسکریپت) 2 | 3 | ابزار اسکریپت KejiLion یک جعبه‌ابزار همه‌کاره برای مدیریت، نظارت و تست سیستم‌های لینوکس است. این ابزار با هدف ارائه راه‌حل‌های ساده و کارآمد برای کاربران مبتدی و حرفه‌ای طراحی شده است. از جمله ویژگی‌های برجسته آن می‌توان به مدیریت پیشرفته Docker، استقرار خودکار LNMP (Linux + Nginx + MySQL + PHP)، بهینه‌سازی امنیتی سایت‌ها، ابزارهای تست شبکه و پشتیبان‌گیری/بازیابی کامل اشاره کرد. همچنین این اسکریپت با پشتیبانی از نصب پنل‌ها و ابزارهای محبوب، نگهداری سیستم را بسیار آسان می‌کند. 4 | 5 | هدف ما تبدیل شدن به بهترین ابزار اسکریپت لینوکس با نصب یک‌کلیکی در سراسر اینترنت است تا پشتیبانی فنی سریع، ساده و حرفه‌ای برای کاربران فراهم شود. 6 | 7 | ## 🚀 نصب با یک کلیک (One-Click Installation) FA 8 | 9 | ```bash 10 | bash <(curl -sL kejilion.sh) ir 11 | -------------------------------------------------------------------------------- /PandoraNext/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "bind": "0.0.0.0:8181", 3 | "tls": { 4 | "enabled": false, 5 | "cert_file": "", 6 | "key_file": "" 7 | }, 8 | "timeout": 600, 9 | "proxy_url": "", 10 | "license_id": "github", 11 | "public_share": false, 12 | "site_password": "", 13 | "setup_password": "webgptpasswd", 14 | "server_tokens": true, 15 | "proxy_api_prefix": "", 16 | "isolated_conv_title": "*", 17 | "disable_signup": false, 18 | "auto_conv_arkose": false, 19 | "proxy_file_service": false, 20 | "custom_doh_host": "", 21 | "captcha": { 22 | "provider": "", 23 | "site_key": "", 24 | "site_secret": "", 25 | "site_login": false, 26 | "setup_login": false, 27 | "oai_username": false, 28 | "oai_password": false, 29 | "oai_signup": false 30 | }, 31 | "whitelist": null 32 | } 33 | -------------------------------------------------------------------------------- /Limiting_Shut_down.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # 获取总的接收和发送流量 4 | output=$(awk 'BEGIN { rx_total = 0; tx_total = 0 } 5 | $1 ~ /^(eth|ens|enp|eno)[0-9]+/ { rx_total += $2; tx_total += $10 } 6 | END { 7 | printf("%.0f Bytes %.0f Bytes", rx_total, tx_total); 8 | }' /proc/net/dev) 9 | 10 | 11 | # 获取接收和发送的流量数据 12 | rx=$(echo "$output" | awk '{print $1}') 13 | tx=$(echo "$output" | awk '{print $3}') 14 | 15 | # 显示当前流量使用情况 16 | echo "当前接收流量: $rx" 17 | echo "当前发送流量: $tx" 18 | 19 | threshold_gb=110 20 | 21 | # 将GB转换为字节 22 | threshold=$((threshold_gb * 1024 * 1024 * 1024)) 23 | 24 | # 检查是否达到流量阈值 25 | if (( $rx > $threshold || $tx > $threshold )); then 26 | echo "流量达到${threshold},正在关闭服务器..." 27 | # 在此处执行关闭服务器的命令,例如: 28 | shutdown -h now 29 | # 或者 30 | # systemctl poweroff 31 | else 32 | echo "当前流量未达到${threshold},继续监视..." 33 | fi 34 | -------------------------------------------------------------------------------- /TG-SSH-check-notify.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | 4 | 5 | 6 | # 获取登录信息 7 | country=$(curl -s ipinfo.io/$public_ip/country) 8 | isp_info=$(curl -s ipinfo.io/org | sed -e 's/\"//g' | awk -F' ' '{print $2}') 9 | 10 | ipv4_address=$(curl -s ipv4.ip.sb) 11 | masked_ip=$(echo $ipv4_address | awk -F'.' '{print "*."$3"."$4}') 12 | 13 | 14 | IP=$(echo $SSH_CONNECTION | awk '{print $1}') 15 | TIME=$(date +"%Y年%m月%d日 %H:%M:%S") 16 | # 查询IP地址对应的地区信息 17 | #LOCATION=$(curl -s https://ipapi.co/$IP/json/ | jq -r '.city') 18 | LOCATION=$(curl -s "http://opendata.baidu.com/api.php?query=$IP&co=&resource_id=6006&oe=utf8&format=json" | jq -r '.data[0].location') 19 | # 获取当前用户名 20 | USERNAME=$(whoami) 21 | # 发送Telegram消息 22 | MESSAGE="ℹ️ 登录信息: 23 | 登录机器:${isp_info}-${country}-${masked_ip} 24 | 登录名:$USERNAME 25 | 登录IP:$IP 26 | 登录时间:$TIME 27 | 登录地区:$LOCATION" 28 | 29 | curl -s -X POST "https://api.telegram.org/bot$TELEGRAM_BOT_TOKEN/sendMessage" -d "chat_id=$CHAT_ID&text=$MESSAGE" > /dev/null 2>&1 -------------------------------------------------------------------------------- /optimized_php.ini: -------------------------------------------------------------------------------- 1 | ; security 2 | display_errors = Off 3 | error_reporting = E_ALL & ~E_NOTICE & ~E_WARNING & ~E_DEPRECATED 4 | 5 | expose_php = Off 6 | allow_url_fopen = Off 7 | allow_url_include = Off 8 | disable_functions = passthru,system,proc_open,popen,parse_ini_file,show_source 9 | default_charset = "UTF-8" 10 | 11 | session.cookie_httponly = 1 12 | session.cookie_secure = 1 13 | session.use_strict_mode = 1 14 | session.use_only_cookies = 1 15 | 16 | 17 | ; Opcache配置 18 | opcache.enable=1 19 | opcache.enable_cli=1 20 | opcache.memory_consumption=512 21 | opcache.interned_strings_buffer=32 22 | opcache.max_accelerated_files=100000 23 | opcache.revalidate_freq=0 24 | opcache.validate_timestamps=0 25 | opcache.fast_shutdown=1 26 | opcache.save_comments=1 27 | opcache.file_update_protection=0 28 | opcache.max_wasted_percentage=5 29 | opcache.jit=tracing 30 | opcache.jit_buffer_size=64M 31 | 32 | 33 | ; Realpath Cache配置 34 | realpath_cache_size=4096k 35 | realpath_cache_ttl=3600 36 | 37 | 38 | -------------------------------------------------------------------------------- /custom_mysql_config-1.cnf: -------------------------------------------------------------------------------- 1 | [mysqld] 2 | 3 | # 连接和线程管理 4 | max_connections = 200 # 小机型避免连接风暴 5 | thread_cache_size = 64 6 | interactive_timeout = 20 7 | wait_timeout = 20 8 | 9 | # InnoDB设置 10 | innodb_buffer_pool_size = 512M # 2G RAM 中最重要的分配,留足系统空间 11 | innodb_buffer_pool_instances = 1 # 小内存不需要分片 12 | innodb_log_buffer_size = 8M 13 | innodb_redo_log_capacity = 64M 14 | innodb_lock_wait_timeout = 30 15 | innodb_file_per_table = 1 16 | innodb_flush_log_at_trx_commit = 1 17 | innodb_io_capacity = 400 # 普通SSD预期值 18 | innodb_io_capacity_max = 800 19 | 20 | # 缓存和表限制 21 | table_open_cache = 512 22 | open_files_limit = 20000 23 | tmp_table_size = 32M 24 | max_heap_table_size = 32M 25 | max_allowed_packet = 32M 26 | 27 | # 缓冲区大小 28 | sort_buffer_size = 2M 29 | read_buffer_size = 512K 30 | join_buffer_size = 1M 31 | 32 | # 日志管理 33 | log_error_verbosity = 3 34 | slow_query_log = 1 35 | slow_query_log_file = /var/log/mysql/slow.log 36 | long_query_time = 1 37 | log_queries_not_using_indexes = 1 38 | 39 | # 其他 40 | sql_mode=STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION 41 | performance_schema=ON 42 | disable-log-bin 43 | 44 | 45 | -------------------------------------------------------------------------------- /nginx.local: -------------------------------------------------------------------------------- 1 | [fail2ban-nginx-cc] 2 | 3 | enabled = true 4 | filter = fail2ban-nginx-cc 5 | chain = DOCKER-USER 6 | port = http,https 7 | action = cloudflare 8 | logpath = /home/web/log/nginx/access.log 9 | maxretry = 3 10 | bantime = 3600 11 | findtime = 3600 12 | ignoreip = 192.168.0.1/24 13 | 14 | 15 | 16 | [nginx-http-auth] 17 | 18 | enabled = true 19 | chain = DOCKER-USER 20 | mode = fallback 21 | port = http,https 22 | logpath = /home/web/log/nginx/error.log 23 | 24 | 25 | 26 | [nginx-limit-req] 27 | 28 | enabled = true 29 | chain = DOCKER-USER 30 | port = http,https 31 | action = cloudflare 32 | logpath = /home/web/log/nginx/error.log 33 | 34 | 35 | 36 | [nginx-botsearch] 37 | 38 | enabled = true 39 | chain = DOCKER-USER 40 | port = http,https 41 | action = cloudflare 42 | logpath = /home/web/log/nginx/error.log 43 | 44 | 45 | 46 | [nginx-bad-request] 47 | 48 | enabled = true 49 | chain = DOCKER-USER 50 | port = http,https 51 | action = cloudflare 52 | logpath = /home/web/log/nginx/access.log 53 | 54 | 55 | 56 | [php-url-fopen] 57 | 58 | enabled = true 59 | chain = DOCKER-USER 60 | port = http,https 61 | action = cloudflare 62 | logpath = /home/web/log/nginx/access.log 63 | -------------------------------------------------------------------------------- /Limiting_Shut_down1.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # 获取总的接收流量(只统计公网网卡) 4 | rx_output=$(awk 'BEGIN { rx_total = 0 } 5 | $1 ~ /^(eth|ens|enp|eno)[0-9]+/ { rx_total += $2 } 6 | END { 7 | printf("%.0f Bytes", rx_total); 8 | }' /proc/net/dev) 9 | 10 | # 获取总的发送流量(只统计公网网卡) 11 | tx_output=$(awk 'BEGIN { tx_total = 0 } 12 | $1 ~ /^(eth|ens|enp|eno)[0-9]+/ { tx_total += $10 } 13 | END { 14 | printf("%.0f Bytes", tx_total); 15 | }' /proc/net/dev) 16 | 17 | # 获取接收流量数据 18 | rx=$(echo "$rx_output" | awk '{print $1}') 19 | 20 | # 获取发送流量数据 21 | tx=$(echo "$tx_output" | awk '{print $1}') 22 | 23 | # 显示当前流量使用情况 24 | echo "当前接收流量: $rx Bytes" 25 | echo "当前发送流量: $tx Bytes" 26 | 27 | rx_threshold_gb=110 28 | tx_threshold_gb=120 29 | 30 | # 将GB转换为字节 31 | rx_threshold=$((rx_threshold_gb * 1024 * 1024 * 1024)) 32 | tx_threshold=$((tx_threshold_gb * 1024 * 1024 * 1024)) 33 | 34 | # 检查是否达到接收流量阈值 35 | if (( rx > rx_threshold )); then 36 | echo "接收流量达到${rx_threshold_gb}GB (${rx_threshold} Bytes),正在关闭服务器..." 37 | shutdown -h now 38 | else 39 | echo "当前接收流量未达到${rx_threshold_gb}GB (${rx_threshold} Bytes),继续监视..." 40 | fi 41 | 42 | # 检查是否达到发送流量阈值 43 | if (( tx > tx_threshold )); then 44 | echo "发送流量达到${tx_threshold_gb}GB (${tx_threshold} Bytes),正在关闭服务器..." 45 | shutdown -h now 46 | else 47 | echo "当前发送流量未达到${tx_threshold_gb}GB (${tx_threshold} Bytes),继续监视..." 48 | fi 49 | -------------------------------------------------------------------------------- /README.tw.md: -------------------------------------------------------------------------------- 1 | # 一鍵腳本工具 (kejilion.sh) 2 | 3 | ## 📜 介紹 (Introduction) 4 | 科技Lion 的 Shell 腳本工具是一款全能腳本工具箱,專為 Linux 監控、測試和管理而設計。無論您是初學者還是經驗豐富的用戶,該工具都能為您提供便利的解決方案。整合了獨創的 Docker 管理功能,讓您輕鬆管理容器化應用;LNMP建站解決方案可協助您快速建置網站,網站最佳化、防禦、備份還原遷移一應俱全;並且整合了各類系統工具面板的安裝及使用,使系統維護變得更加簡單。我們的目標是成為全網最優秀的 Linux 一鍵腳本工具,提供使用者高效、便利的科技支援。 5 | 6 | *** 7 | 8 | ## 🌐 支援系統 9 | >Ubuntu 10 | >Debian 11 | >CentOS 12 | >Alpine 13 | >Kali 14 | >Arch 15 | >RedHat 16 | >Fedora 17 | >Alma 18 | >Rocky 19 | *** 20 | 21 | ## 🚀 一鍵安裝 22 | ```bash 23 | bash <(curl -sL kejilion.sh) tw 24 | ``` 25 | 26 | *** 27 | 28 | ## 🖼️ 실제 화면 미리보기 (Preview) 29 | 30 | 한국어 버전 미리보기 31 | 32 | 33 | 34 | 35 | 36 | *** 37 | ## 📦 核心功能 38 | 39 | - **系統資訊概覽**:快速展示 CPU、記憶體、磁碟、頻寬等運作狀態 40 | 41 | - **網路測試工具**:整合測速、回程、延遲、丟包偵測等 42 | 43 | - **Docker 容器管理**:獨家容器視覺化 + 容器控制增強指令 44 | 45 | - **LNMP 一鍵部署**:輕鬆建立 Nginx + MySQL + PHP 站點 46 | 47 | - **網站防禦與最佳化**:防CC、防爬蟲,自動設定防火牆與效能最佳化 48 | 49 | - **備份與遷移**:網站與資料庫一鍵備份/還原/遠端遷移 50 | 51 | - **BBR 加速優化**:核心加速、網路擁塞控制智慧切換 52 | 53 | - **應用市場整合**:內建主流工具與面板,支援一鍵安裝常用服務 54 | 55 | - **自動更新機制**:定時偵測腳本版本,保持最新最穩定 56 | 57 | *** 58 | 59 | ## 💖 支持我們 60 | 覺得腳本還可以 USTD TRC20 打賞 61 | 62 | TCP3PLGUTG9Z4z4tnHHSLbw5bgp8NXhTT3 63 | 64 | *** 65 | 66 | ## Star History 67 | [![Star History Chart](https://api.star-history.com/svg?repos=kejilion/sh&type=Date)](https://star-history.com/#kejilion/sh&Date) 68 | -------------------------------------------------------------------------------- /client_config: -------------------------------------------------------------------------------- 1 | #在oci=begin和oci=end之间放入你的API配置信息 支持多个配置文件 机器人切换profile可更换操作配置 2 | oci=begin 3 | 4 | [DEFAULT] 5 | user=ocid1.user.oc1..aaaaaaaaxxxxgwlg3xuzwgsaazxtzbozqq 6 | fingerprint=b8:33:6f:xxxx:45:43:33 7 | tenancy=ocid1.tenancy.oc1..aaaaaaaaxxx7x7h4ya 8 | region=ap-singapore-1 9 | key_file=写你的API密钥文件路径 10 | 11 | [DEFAULT2] 12 | user=ocid1.user.oc1..aaaaaaaaxxxxgwlg3xuzwgsaazxtzbozqq 13 | fingerprint=b8:33:6f:xxxx:45:43:33 14 | tenancy=ocid1.tenancy.oc1..aaaaaaaaxxx7x7h4ya 15 | region=ap-singapore-1 16 | key_file=写你的API密钥文件路径 17 | 18 | oci=end 19 | 20 | 21 | 22 | #用户信息 从 https://t.me/radiance_helper_bot 配置(bot可使用/raninfo命令随机生成) 23 | #必传 24 | username= 25 | #必传 26 | password= 27 | 28 | 29 | #cloudflare 功能参数 非必传 30 | #非必传 cloudflare邮箱 31 | cf_email= 32 | #非必传 cloudflare key 在我的个人资料->API令牌处->API密钥->Global API Key 获取 33 | cf_account_key= 34 | 35 | 36 | #非必填 本机ip和端口号 (进阶玩家选项 可填写域名) 不写将自动获取本机ip 并使用默认端口号9527 (小白用户建议不填) 如填写 格式为:https://xxx.xx:9527 37 | local_address= 38 | #非必填 url名称(默认为address 可在bot上修改) 39 | local_url_name= 40 | 41 | #非必填 启动模式 填写local为启动本地无公网IP模式(只要能联网即可) 不填或填其他 则启动端口模式 42 | model= 43 | 44 | 45 | 46 | #在azure=begin和azure=end之间放入你的azure的API配置信息 支持多个配置文件 机器人切换profile可更换操作配置 上传配置支持使用原格式({"appId":"xxx","password":"xxx"...})上传 47 | azure=begin 48 | 49 | [az001] 50 | appId=551xxxx7-xxxx-xxxx-xxxx-b9xxxx60cc65 51 | password=T618Q~.LIy_xxxxx~jm~xxxxxx 52 | tenant=xxxx3713-xxxx-4cb5-xxxx-3001060xxxxx 53 | 54 | azure=end -------------------------------------------------------------------------------- /custom_mysql_config.cnf: -------------------------------------------------------------------------------- 1 | [mysqld] 2 | 3 | # 连接和线程管理 4 | max_connections = 2048 5 | thread_cache_size = 512 6 | interactive_timeout = 30 7 | wait_timeout = 30 8 | 9 | # 查询缓存(MySQL8废除Query Cache,不配置) 10 | # no query_cache_size or query_cache_type needed 11 | 12 | # InnoDB设置 13 | innodb_buffer_pool_size = 4096M # ⭐如果内存允许,给到一半RAM,数据库读性能暴涨 14 | innodb_buffer_pool_instances = 4 # ⭐分片更细(>2G建议4-8分片) 15 | innodb_log_buffer_size = 32M # ⭐更大事务写更稳 16 | innodb_redo_log_capacity = 128M # ⭐防止大事务日志爆满 17 | innodb_lock_wait_timeout = 30 18 | innodb_file_per_table = 1 19 | innodb_flush_log_at_trx_commit = 1 # ⭐坚持ACID,不放松一致性 20 | innodb_io_capacity = 2000 # ⭐如果是NVMe磁盘可以调高(>SSD) 21 | innodb_io_capacity_max = 4000 22 | 23 | # 缓存和表限制 24 | table_open_cache = 4000 # ⭐动态表多的网站,加大打开表缓存 25 | open_files_limit = 65535 # ⭐极限设置(注意宿主机ulimit) 26 | tmp_table_size = 64M # ⭐调大,减少临时表落磁盘 27 | max_heap_table_size = 64M # ⭐配合tmp_table_size,一起调大 28 | max_allowed_packet = 64M # ⭐适配大SQL(比如大BLOB字段) 29 | 30 | # 缓冲区大小 31 | sort_buffer_size = 8M # ⭐适配中大型ORDER BY场景 32 | read_buffer_size = 2M 33 | join_buffer_size = 4M # ⭐稍微放大Join场景效率更高 34 | 35 | # 日志管理 36 | log_error_verbosity = 3 # ⭐详细日志,便于追查慢问题 37 | slow_query_log = 1 # ⭐打开慢查询日志 38 | slow_query_log_file = /var/log/mysql/slow.log 39 | long_query_time = 1 # ⭐超过1秒算慢查询 40 | log_queries_not_using_indexes = 1 # ⭐记录无索引扫描 41 | 42 | # 其他 43 | sql_mode=STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION 44 | performance_schema=ON # ⭐生产环境推荐打开,监控分析好用 45 | disable-log-bin 46 | -------------------------------------------------------------------------------- /README.kr.md: -------------------------------------------------------------------------------- 1 | 2 | # 원클릭 스크립트 도구(kejilion.sh) 3 | 4 | ## 📜 소개 5 | TechLion의 Shell Script Tool은 Linux 모니터링, 테스트, 관리를 위해 설계된 올인원 스크립팅 툴박스입니다. 초보자든 숙련된 사용자든, 이 도구는 편리한 솔루션을 제공할 수 있습니다. 원래의 Docker 관리 기능을 통합하여 컨테이너화된 애플리케이션을 쉽게 관리할 수 있습니다. LNMP 웹사이트 구축 솔루션은 웹사이트를 빠르게 구축하는 데 도움이 되며, 사이트 최적화, 방어, 백업, 복구 및 마이그레이션 기능을 완벽하게 갖추고 있습니다. 다양한 시스템 도구 패널의 설치와 사용을 통합하여 시스템 유지관리를 더욱 쉽게 만들어줍니다. 저희의 목표는 전체 네트워크 상에서 최고의 Linux 원클릭 스크립팅 도구가 되어 사용자에게 효율적이고 편리한 기술 지원을 제공하는 것입니다. 6 | 7 | *** 8 | 9 | ## 🌐 지원 시스템 10 | >Ubuntu 11 | >Debian 12 | >CentOS 13 | >Alpine 14 | >Kali 15 | >Arch 16 | >RedHat 17 | >Fedora 18 | >Alma 19 | >Rocky 20 | *** 21 | 22 | 23 | ## 🚀 원클릭 설치 24 | ```bash 25 | bash <(curl -sL kejilion.sh) kr 26 | ``` 27 | *** 28 | 29 | ## 🖼️ 실제 화면 미리보기 (Preview) 30 | 31 | 한국어 버전 미리보기 32 | 33 | 34 | 35 | 36 | 37 | *** 38 | ## 📦 핵심 기능 39 | 40 | - **시스템 정보 개요**: CPU, 메모리, 디스크, 대역폭 등의 작동 상태를 빠르게 표시합니다. 41 | 42 | - **네트워크 테스트 도구**: 통합 속도 테스트, 백홀, 지연, 패킷 손실 감지 등 43 | 44 | - **Docker 컨테이너 관리**: 독점적인 컨테이너 시각화 + 향상된 컨테이너 제어 명령 45 | 46 | - **LNMP 원클릭 배포**: Nginx + MySQL + PHP 사이트를 쉽게 구축 47 | 48 | - **웹사이트 방어 및 최적화**: CC 차단, 크롤러 차단, 방화벽 자동 구성 및 성능 최적화 49 | 50 | - **백업 및 마이그레이션**: 사이트 및 데이터베이스의 원클릭 백업/복원/원격 마이그레이션 51 | 52 | - **BBR 가속 최적화**: 커널 가속, 네트워크 혼잡 제어 지능형 스위칭 53 | 54 | - **애플리케이션 마켓 통합**: 기본 제공 도구 및 패널, 공통 서비스의 원클릭 설치 지원 55 | 56 | - **자동 업데이트 메커니즘**: 스크립트 버전을 정기적으로 확인하여 최신 상태로 유지하고 안정성을 유지합니다. 57 | 58 | *** 59 | 60 | ## 💖 저희를 지원해주세요 61 | 대본은 괜찮은 것 같아요. USTD TRC20 보상 62 | 63 | TCP3PLGUTG9Z4z4tnHHSLbw5bgp8NXhTT3 64 | 65 | *** 66 | 67 | ## 스타 역사 68 | [![별 역사 차트](https://api.star-history.com/svg?repos=kejilion/sh&type=Date)](https://star-history.com/#kejilion/sh&Date) 69 | -------------------------------------------------------------------------------- /README.ja.md: -------------------------------------------------------------------------------- 1 | 2 | # ワンクリック スクリプト ツール (kejilion.sh) 3 | 4 | ## 📜 はじめに 5 | TechLion のシェル スクリプト ツールは、Linux の監視、テスト、管理用に設計されたオールインワンのスクリプト ツールボックスです。初心者でも経験豊富なユーザーでも、このツールは便利なソリューションを提供します。オリジナルの Docker 管理機能を統合しており、コンテナ化されたアプリケーションを簡単に管理できます。 LNMP ウェブサイト構築ソリューションは、ウェブサイトを迅速に構築するのに役立ち、サイトの最適化、防御、バックアップ、復元、移行などの機能が完全に装備されています。また、さまざまなシステム ツール パネルのインストールと使用を統合し、システムのメンテナンスを容易にします。私たちの目標は、ネットワーク全体で最高の Linux ワンクリック スクリプト ツールとなり、ユーザーに効率的で便利な技術サポートを提供することです。 6 | 7 | *** 8 | 9 | ## 🌐 サポートされているシステム 10 | >Ubuntu 11 | >Debian 12 | >CentOS 13 | >Alpine 14 | >Kali 15 | >Arch 16 | >RedHat 17 | >Fedora 18 | >Alma 19 | >Rocky 20 | *** 21 | 22 | ## 🚀 ワンクリックインストール 23 | ```bash 24 | bash <(curl -sL kejilion.sh) jp 25 | ``` 26 | 27 | *** 28 | ## 🖼️ 実際のスクリーンショット 29 | 30 | 日本語版プレビュー 31 | 32 | 33 | *** 34 | 35 | ## 📦 コア機能 36 | 37 | - **システム情報概要**: CPU、メモリ、ディスク、帯域幅などの動作状態をすばやく表示します。 38 | 39 | - **ネットワーク テスト ツール**: 統合速度テスト、バックホール、遅延、パケット損失検出など。 40 | 41 | - **Docker コンテナ管理**: 独自のコンテナ可視化 + 強化されたコンテナ制御コマンド 42 | 43 | - **LNMPワンクリックデプロイメント**: Nginx + MySQL + PHPサイトを簡単に構築 44 | 45 | - **ウェブサイトの防御と最適化**:CC対策、クローラー対策、ファイアウォールの自動構成、パフォーマンスの最適化 46 | 47 | - **バックアップと移行**: サイトとデータベースのワンクリックバックアップ/復元/リモート移行 48 | 49 | - **BBRアクセラレーション最適化**:カーネルアクセラレーション、ネットワーク輻輳制御インテリジェントスイッチング 50 | 51 | - **アプリケーションマーケット統合**: 主流のツールとパネルが組み込まれており、一般的なサービスのワンクリックインストールをサポートします。 52 | 53 | - **自動更新メカニズム**: スクリプトのバージョンを定期的にチェックして、最新かつ安定した状態を維持します 54 | 55 | *** 56 | 57 | ## 💖 私たちをサポートしてください 58 | 脚本は大丈夫だと思います。 USTD TRC20報酬 59 | 60 | TCP3PLGUTG9Z4z4tnHHSLbw5bgp8NXhTT3 61 | 62 | *** 63 | 64 | ## スターの歴史 65 | [![星の歴史チャート](https://api.star-history.com/svg?repos=kejilion/sh&type=Date)](https://star-history.com/#kejilion/sh&Date) 66 | -------------------------------------------------------------------------------- /archive.key: -------------------------------------------------------------------------------- 1 | -----BEGIN PGP PUBLIC KEY BLOCK----- 2 | Version: GnuPG v2 3 | 4 | mQENBFhxW04BCAC61HuxBVf1XJiQjXu/DSAtVcnuK38geDoDjcqFtHskFy32NgJG 5 | X118EFNym6noF+oibaSftI9yjHthWvMnYZ/+DPwd7YZhbAjBvxMIQCsP6cFVxrgc 6 | VV8g+uh4TCfbpalDBFoncRhQCgkmDN9Vd4kIWRh6BHJuzpKB/h2KxUHZVEKgWlK2 7 | dR1xUtbrc+kp8gLwPbxTgC3tZ4x2uMMMlnbyCMSRa5oJ/AvoW4W1XphKL9ivsFHM 8 | PSQkUBDvgv2RPw+0XBxPy8SYE0r0onx0ZIpjJRTODt3bSV6/0owwlpNogV9bT8HY 9 | kl3+w3mTwax6S1akHZuJtLkZS0uUBz1BHt5bABEBAAG0IVhhbk1vZCBLZXJuZWwg 10 | PGtlcm5lbEB4YW5tb2Qub3JnPokBNwQTAQgAIQUCWHFbTgIbAwULCQgHAgYVCAkK 11 | CwIEFgIDAQIeAQIXgAAKCRCG99Ce5zTmIwTmB/9/S4rmwU6efDgEaBDwBDbOfLBA 12 | P2+kDpabjG4K+V4NSvDqlPN49KrI7C21jHghAa2VuTPbSZVQ9ziUd5DjX9OuXov8 13 | CYVG+rrlG1UadHS8SBpgw0gNylEvo9/U6u0hl8mrbVOlpzu+eE+e4cMTHax2y580 14 | fC2xmnM8wKgyRFEyVc6ilWU+UNTAeUFlg0YfU3cV1Ut4DzVFfamtNYg0p7Q/9MSy 15 | VgFpt5C2U5prk4wi++51OgrtaNhMrUhzYXLINWVF6IrXhQ+mkI/FWXUZ0oyVo55v 16 | +dQzuds/gos90q+tKyE514pYAmwQSftSjf+RmHOMpPQyMZZKSywrz4vlfveDuQEN 17 | BFhxW04BCACs5bXq73MDb2+AsvNL2XkkbnzmE4K3k0gejB9OxrO+puAZn3wWyYIk 18 | b0Op8qVUh+/FIiW/uFfmdFD8BypC3YkCNfg6e74f5TT3qQciccpMGy62teo3jfhT 19 | T8E1OL1i76ALq7eNbByJKiKLBrTUDM6BDIeRZBWXQMase4+aqUAP47Kd/ByPsmCh 20 | /pzb6yPdDPKwkspELssdPXYI7enddjQsCPoBko0j8CTPgKqMTeCuKMXCtD2gtRBN 21 | eoVj4cbjZoZvBh8oJktzbYA8FX8eKdxIXhSP9MoVOPSWhxIQdwzkzUPK+0vUV8jA 22 | NBTnGOkrRJPOHGPJWFWnTUGrzvcwi7czABEBAAGJAR8EGAEIAAkFAlhxW04CGwwA 23 | CgkQhvfQnuc05iMIswgAmzSpCHFGKdkFLdC673FidJcL8adKFTO5Mpyholc5N8vG 24 | ROJbpso+DpssF14NKoBfBWqPRgHxYzHakxHiNf0R2+EEwXH3rblzpx3PXzB0OgNe 25 | T9T0UStrGgc9nZ8nZVURHZZ2z5zakEWS+rB2TiSxz3YArR3wiTHQW49G09uZvfp6 26 | 5Mim2w+eUxbQ689eT0DlDI1d2eDP/j5lrv1elsg3kBE2Awzdvi8DdGUpMFrSsYJw 27 | WS85uZrwbeAs/nPO62wNIvAbbRsWnDg3AV3vc02eRvy52tTBY1W/67N02M4AxgPd 28 | ukDDFZMifwa03yTHD/a57O4dFOnzsEVojBnbzQ7W7w== 29 | =HKlF 30 | -----END PGP PUBLIC KEY BLOCK----- 31 | -------------------------------------------------------------------------------- /auto_cert_renewal-1.sh: -------------------------------------------------------------------------------- 1 | # 定义证书存储目录 2 | certs_directory="/etc/letsencrypt/live/" 3 | 4 | days_before_expiry=5 # 设置在证书到期前几天触发续签 5 | 6 | # 遍历所有证书文件 7 | for cert_dir in $certs_directory*; do 8 | # 获取域名 9 | domain=$(basename "$cert_dir") 10 | 11 | # 忽略 README 目录 12 | if [ "$domain" = "README" ]; then 13 | continue 14 | fi 15 | 16 | # 输出正在检查的证书信息 17 | echo "检查证书过期日期: ${domain}" 18 | 19 | # 获取fullchain.pem文件路径 20 | cert_file="${cert_dir}/fullchain.pem" 21 | 22 | # 获取证书过期日期 23 | expiration_date=$(openssl x509 -enddate -noout -in "${cert_file}" | cut -d "=" -f 2-) 24 | 25 | # 输出证书过期日期 26 | echo "过期日期: ${expiration_date}" 27 | 28 | # 将日期转换为时间戳 29 | expiration_timestamp=$(date -d "${expiration_date}" +%s) 30 | current_timestamp=$(date +%s) 31 | 32 | # 计算距离过期还有几天 33 | days_until_expiry=$(( ($expiration_timestamp - $current_timestamp) / 86400 )) 34 | 35 | # 检查是否需要续签(在满足续签条件的情况下) 36 | if [ $days_until_expiry -le $days_before_expiry ]; then 37 | echo "证书将在${days_before_expiry}天内过期,正在进行自动续签。" 38 | 39 | # 停止 Nginx 40 | docker stop nginx 41 | 42 | iptables -P INPUT ACCEPT 43 | iptables -P FORWARD ACCEPT 44 | iptables -P OUTPUT ACCEPT 45 | iptables -F 46 | 47 | ip6tables -P INPUT ACCEPT 48 | ip6tables -P FORWARD ACCEPT 49 | ip6tables -P OUTPUT ACCEPT 50 | ip6tables -F 51 | 52 | # 续签证书 53 | certbot certonly --standalone -d $domain --email your@email.com --agree-tos --no-eff-email --force-renewal 54 | 55 | # 启动 Nginx 56 | docker start nginx 57 | 58 | echo "证书已成功续签。" 59 | else 60 | # 若未满足续签条件,则输出证书仍然有效 61 | echo "证书仍然有效,距离过期还有 ${days_until_expiry} 天。" 62 | fi 63 | 64 | # 输出分隔线 65 | echo "--------------------------" 66 | done 67 | -------------------------------------------------------------------------------- /CF-Under-Attack.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # 设置变量 4 | EMAIL="AAAA" 5 | API_KEY="BBBB" 6 | ZONE_ID="CCCC" 7 | LOAD_THRESHOLD=5.0 # 设置高负载阈值 8 | 9 | TELEGRAM_BOT_TOKEN="输入TG机器人API" 10 | CHAT_ID="输入TG用户ID" 11 | 12 | 13 | # 获取当前系统负载 14 | CURRENT_LOAD=$(uptime | awk -F'load average:' '{ print $2 }' | cut -d, -f1 | awk '{print $1}') 15 | 16 | echo "当前系统负载: $CURRENT_LOAD" 17 | 18 | 19 | send_tg_notification() { 20 | local MESSAGE=$1 21 | curl -s -X POST "https://api.telegram.org/bot$TELEGRAM_BOT_TOKEN/sendMessage" -d "chat_id=$CHAT_ID" -d "text=$MESSAGE" 22 | } 23 | 24 | 25 | 26 | # 获取当前的“Under Attack”模式状态 27 | STATUS=$(curl -s -X GET "https://api.cloudflare.com/client/v4/zones/$ZONE_ID/settings/security_level" \ 28 | -H "X-Auth-Email: $EMAIL" \ 29 | -H "X-Auth-Key: $API_KEY" \ 30 | -H "Content-Type: application/json" | jq -r '.result.value') 31 | 32 | echo "当前的Under Attack模式状态: $STATUS" 33 | 34 | # 检查系统负载是否高于阈值 35 | if (( $(echo "$CURRENT_LOAD > $LOAD_THRESHOLD" | bc -l) )); then 36 | if [ "$STATUS" != "under_attack" ]; then 37 | echo "系统负载高于阈值,开启Under Attack模式" 38 | # send_tg_notification "系统负载高于阈值,开启Under Attack模式" 39 | NEW_STATUS="under_attack" 40 | else 41 | echo "系统负载高,但Under Attack模式已经开启" 42 | exit 0 43 | fi 44 | else 45 | if [ "$STATUS" == "under_attack" ]; then 46 | echo "系统负载低于阈值,关闭Under Attack模式" 47 | # send_tg_notification "系统负载低于阈值,关闭Under Attack模式" 48 | NEW_STATUS="high" 49 | else 50 | echo "系统负载低,Under Attack模式已经关闭" 51 | exit 0 52 | fi 53 | fi 54 | 55 | # 更新“Under Attack”模式状态 56 | RESPONSE=$(curl -s -X PATCH "https://api.cloudflare.com/client/v4/zones/$ZONE_ID/settings/security_level" \ 57 | -H "X-Auth-Email: $EMAIL" \ 58 | -H "X-Auth-Key: $API_KEY" \ 59 | -H "Content-Type: application/json" \ 60 | --data "{\"value\":\"$NEW_STATUS\"}") 61 | 62 | if [[ $(echo $RESPONSE | jq -r '.success') == "true" ]]; then 63 | echo "成功更新Under Attack模式状态为: $NEW_STATUS" 64 | else 65 | echo "更新Under Attack模式状态失败" 66 | echo "响应: $RESPONSE" 67 | fi 68 | -------------------------------------------------------------------------------- /auto_cert_renewal.sh: -------------------------------------------------------------------------------- 1 | # 定义证书存储目录 2 | certs_directory="/home/web/certs/" 3 | days_before_expiry=15 # 设置在证书到期前几天触发续签 4 | 5 | # 遍历所有证书文件 6 | for cert_file in $certs_directory*_cert.pem; do 7 | # 获取域名 8 | yuming=$(basename "$cert_file" "_cert.pem") 9 | 10 | # 输出正在检查的证书信息 11 | echo "检查证书过期日期: ${yuming}" 12 | 13 | # 获取证书过期日期 14 | expiration_date=$(openssl x509 -enddate -noout -in "${certs_directory}${yuming}_cert.pem" | cut -d "=" -f 2-) 15 | 16 | # 输出证书过期日期 17 | echo "过期日期: ${expiration_date}" 18 | 19 | # 将日期转换为时间戳 20 | expiration_timestamp=$(date -d "${expiration_date}" +%s) 21 | current_timestamp=$(date +%s) 22 | 23 | # 计算距离过期还有几天 24 | days_until_expiry=$(( ($expiration_timestamp - $current_timestamp) / 86400 )) 25 | 26 | # 检查是否需要续签(在满足续签条件的情况下) 27 | if [ $days_until_expiry -le $days_before_expiry ]; then 28 | echo "证书将在${days_before_expiry}天内过期,正在进行自动续签。" 29 | 30 | docker run --rm -v /etc/letsencrypt/:/etc/letsencrypt certbot/certbot delete --cert-name "$yuming" -n 31 | 32 | docker stop nginx > /dev/null 2>&1 33 | 34 | if ! iptables -C INPUT -p tcp --dport 80 -j ACCEPT 2>/dev/null; then 35 | iptables -I INPUT 1 -p tcp --dport 80 -j ACCEPT 36 | fi 37 | 38 | # iptables -P INPUT ACCEPT 39 | # iptables -P FORWARD ACCEPT 40 | # iptables -P OUTPUT ACCEPT 41 | # iptables -F 42 | 43 | # ip6tables -P INPUT ACCEPT 44 | # ip6tables -P FORWARD ACCEPT 45 | # ip6tables -P OUTPUT ACCEPT 46 | # ip6tables -F 47 | 48 | docker run --rm -p 80:80 -v /etc/letsencrypt/:/etc/letsencrypt certbot/certbot certonly --standalone -d $yuming --email your@email.com --agree-tos --no-eff-email --force-renewal --key-type ecdsa 49 | 50 | mkdir -p /home/web/certs/ 51 | cp /etc/letsencrypt/live/$yuming/fullchain.pem /home/web/certs/${yuming}_cert.pem > /dev/null 2>&1 52 | cp /etc/letsencrypt/live/$yuming/privkey.pem /home/web/certs/${yuming}_key.pem > /dev/null 2>&1 53 | 54 | openssl rand -out /home/web/certs/ticket12.key 48 55 | openssl rand -out /home/web/certs/ticket13.key 80 56 | 57 | docker start nginx > /dev/null 2>&1 58 | 59 | 60 | echo "证书已成功续签。" 61 | else 62 | # 若未满足续签条件,则输出证书仍然有效 63 | echo "证书仍然有效,距离过期还有 ${days_until_expiry} 天。" 64 | fi 65 | 66 | # 输出分隔线 67 | echo "--------------------------" 68 | done 69 | -------------------------------------------------------------------------------- /ldnmp.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # 获取用户输入,用于替换 docker-compose.yml 文件中的占位符 4 | read -p "请输入 数据库ROOT密码:" dbrootpasswd 5 | read -p "请输入 数据库用户名:" dbuse 6 | read -p "请输入 数据库用户密码:" dbusepasswd 7 | 8 | 9 | # 更新并安装必要的软件包 10 | DEBIAN_FRONTEND=noninteractive apt update -y 11 | DEBIAN_FRONTEND=noninteractive apt full-upgrade -y 12 | apt install -y curl wget sudo socat unzip tar htop 13 | 14 | # 安装 Docker 15 | curl -fsSL https://get.docker.com | sh 16 | 17 | # 安装 Docker Compose 18 | curl -L "https://github.com/docker/compose/releases/latest/download/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose && chmod +x /usr/local/bin/docker-compose 19 | 20 | # 创建必要的目录和文件 21 | cd /home && mkdir -p web/html web/mysql web/certs web/conf.d web/redis && touch web/docker-compose.yml 22 | 23 | # 下载 docker-compose.yml 文件并进行替换 24 | wget -O /home/web/docker-compose.yml https://raw.githubusercontent.com/kejilion/docker/main/LNMP-docker-compose-4.yml 25 | 26 | 27 | # 在 docker-compose.yml 文件中进行替换 28 | sed -i "s/webroot/$dbrootpasswd/g" /home/web/docker-compose.yml 29 | sed -i "s/kejilionYYDS/$dbusepasswd/g" /home/web/docker-compose.yml 30 | sed -i "s/kejilion/$dbuse/g" /home/web/docker-compose.yml 31 | 32 | iptables -P INPUT ACCEPT 33 | iptables -P FORWARD ACCEPT 34 | iptables -P OUTPUT ACCEPT 35 | iptables -F 36 | 37 | cd /home/web && docker-compose up -d 38 | 39 | docker exec php apt update && 40 | docker exec php apt install -y libmariadb-dev-compat libmariadb-dev libzip-dev libmagickwand-dev imagemagick && 41 | docker exec php docker-php-ext-install mysqli pdo_mysql zip exif gd intl bcmath opcache && 42 | docker exec php pecl install imagick && 43 | docker exec php sh -c 'echo "extension=imagick.so" > /usr/local/etc/php/conf.d/imagick.ini' && 44 | docker exec php pecl install redis && 45 | docker exec php sh -c 'echo "extension=redis.so" > /usr/local/etc/php/conf.d/docker-php-ext-redis.ini' && 46 | docker exec php sh -c 'echo "upload_max_filesize=50M \n post_max_size=50M" > /usr/local/etc/php/conf.d/uploads.ini' && 47 | docker exec php sh -c 'echo "memory_limit=256M" > /usr/local/etc/php/conf.d/memory.ini' 48 | 49 | 50 | docker exec php74 apt update && 51 | docker exec php74 apt install -y libmariadb-dev-compat libmariadb-dev libzip-dev libmagickwand-dev imagemagick && 52 | docker exec php74 docker-php-ext-install mysqli pdo_mysql zip gd intl bcmath opcache && 53 | docker exec php74 pecl install imagick && 54 | docker exec php74 sh -c 'echo "extension=imagick.so" > /usr/local/etc/php/conf.d/imagick.ini' && 55 | docker exec php74 pecl install redis && 56 | docker exec php74 sh -c 'echo "extension=redis.so" > /usr/local/etc/php/conf.d/docker-php-ext-redis.ini' && 57 | docker exec php74 sh -c 'echo "upload_max_filesize=50M \n post_max_size=50M" > /usr/local/etc/php/conf.d/uploads.ini' && 58 | docker exec php74 sh -c 'echo "memory_limit=256M" > /usr/local/etc/php/conf.d/memory.ini' 59 | 60 | -------------------------------------------------------------------------------- /en/to-en.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | 4 | from deep_translator import GoogleTranslator 5 | import re 6 | import os 7 | 8 | def is_chinese(text): 9 | return bool(re.search(r'[\u4e00-\u9fff]', text)) 10 | 11 | def translate_text(text): 12 | try: 13 | return GoogleTranslator(source='zh-CN', target='en').translate(text) 14 | except Exception as e: 15 | print(f"\nTranslation error: {e}") 16 | return text 17 | 18 | def translate_line_preserving_variables(line): 19 | """ 20 | Translate only Chinese parts in echo/read/send_stats commands, excluding shell variables 21 | """ 22 | # Match double or single quoted strings 23 | def repl(match): 24 | full_string = match.group(0) 25 | quote = full_string[0] 26 | content = full_string[1:-1] 27 | 28 | # Split by variable expressions 29 | parts = re.split(r'(\$\{?\w+\}?)', content) 30 | translated_parts = [ 31 | translate_text(p) if is_chinese(p) else p 32 | for p in parts 33 | ] 34 | return quote + ''.join(translated_parts) + quote 35 | 36 | return re.sub(r'(?:\'[^\']*\'|"[^"]*")', repl, line) 37 | 38 | def translate_file(input_file, output_file): 39 | total_lines = sum(1 for _ in open(input_file, 'r', encoding='utf-8')) 40 | processed_lines = 0 41 | 42 | with open(input_file, 'r', encoding='utf-8') as f_in, \ 43 | open(output_file, 'w', encoding='utf-8') as f_out: 44 | 45 | for line in f_in: 46 | processed_lines += 1 47 | progress = processed_lines / total_lines * 100 48 | print(f"\rProcessing: {progress:.1f}% ({processed_lines}/{total_lines})", end='') 49 | 50 | leading_space = re.match(r'^(\s*)', line).group(1) 51 | stripped = line.strip() 52 | 53 | if stripped.startswith('#') and is_chinese(stripped): 54 | comment_mark = '#' 55 | comment_text = stripped[1:].strip() 56 | if comment_text: 57 | translated = translate_text(comment_text) 58 | f_out.write(f"{leading_space}{comment_mark} {translated}\n") 59 | else: 60 | f_out.write(line) 61 | 62 | elif any(cmd in stripped for cmd in ['echo', 'read', 'send_stats']) and is_chinese(stripped): 63 | translated_line = translate_line_preserving_variables(line) 64 | f_out.write(translated_line) 65 | 66 | else: 67 | f_out.write(line) 68 | 69 | print("\nTranslation completed.") 70 | print(f"Original file size: {os.path.getsize(input_file)} bytes") 71 | print(f"Translated file size: {os.path.getsize(output_file)} bytes") 72 | 73 | if __name__ == "__main__": 74 | input_file = 'kejilion.sh' 75 | output_file = 'kejilion_en.sh' 76 | translate_file(input_file, output_file) 77 | -------------------------------------------------------------------------------- /ir/to-fa.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | 4 | from deep_translator import GoogleTranslator 5 | import re 6 | import os 7 | 8 | def is_chinese(text): 9 | return bool(re.search(r'[\u4e00-\u9fff]', text)) 10 | 11 | def translate_text(text): 12 | try: 13 | return GoogleTranslator(source='zh-CN', target='fa').translate(text) 14 | except Exception as e: 15 | print(f"\nTranslation error: {e}") 16 | return text 17 | 18 | def translate_line_preserving_variables(line): 19 | """ 20 | Translate only Chinese parts in echo/read/send_stats commands, excluding shell variables 21 | """ 22 | # Match double or single quoted strings 23 | def repl(match): 24 | full_string = match.group(0) 25 | quote = full_string[0] 26 | content = full_string[1:-1] 27 | 28 | # Split by variable expressions 29 | parts = re.split(r'(\$\{?\w+\}?)', content) 30 | translated_parts = [ 31 | translate_text(p) if is_chinese(p) else p 32 | for p in parts 33 | ] 34 | return quote + ''.join(translated_parts) + quote 35 | 36 | return re.sub(r'(?:\'[^\']*\'|"[^"]*")', repl, line) 37 | 38 | def translate_file(input_file, output_file): 39 | total_lines = sum(1 for _ in open(input_file, 'r', encoding='utf-8')) 40 | processed_lines = 0 41 | 42 | with open(input_file, 'r', encoding='utf-8') as f_in, \ 43 | open(output_file, 'w', encoding='utf-8') as f_out: 44 | 45 | for line in f_in: 46 | processed_lines += 1 47 | progress = processed_lines / total_lines * 100 48 | print(f"\rProcessing: {progress:.1f}% ({processed_lines}/{total_lines})", end='') 49 | 50 | leading_space = re.match(r'^(\s*)', line).group(1) 51 | stripped = line.strip() 52 | 53 | if stripped.startswith('#') and is_chinese(stripped): 54 | comment_mark = '#' 55 | comment_text = stripped[1:].strip() 56 | if comment_text: 57 | translated = translate_text(comment_text) 58 | f_out.write(f"{leading_space}{comment_mark} {translated}\n") 59 | else: 60 | f_out.write(line) 61 | 62 | elif any(cmd in stripped for cmd in ['echo', 'read', 'send_stats']) and is_chinese(stripped): 63 | translated_line = translate_line_preserving_variables(line) 64 | f_out.write(translated_line) 65 | 66 | else: 67 | f_out.write(line) 68 | 69 | print("\nTranslation completed.") 70 | print(f"Original file size: {os.path.getsize(input_file)} bytes") 71 | print(f"Translated file size: {os.path.getsize(output_file)} bytes") 72 | 73 | if __name__ == "__main__": 74 | input_file = 'kejilion.sh' 75 | output_file = 'kejilion_fa.sh' 76 | translate_file(input_file, output_file) 77 | -------------------------------------------------------------------------------- /jp/to-jp.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | 4 | from deep_translator import GoogleTranslator 5 | import re 6 | import os 7 | 8 | def is_chinese(text): 9 | return bool(re.search(r'[\u4e00-\u9fff]', text)) 10 | 11 | def translate_text(text): 12 | try: 13 | return GoogleTranslator(source='auto', target='ja').translate(text) 14 | except Exception as e: 15 | print(f"\nTranslation error: {e}") 16 | return text 17 | 18 | def translate_line_preserving_variables(line): 19 | """ 20 | Translate only Chinese parts in echo/read/send_stats commands, excluding shell variables 21 | """ 22 | # Match double or single quoted strings 23 | def repl(match): 24 | full_string = match.group(0) 25 | quote = full_string[0] 26 | content = full_string[1:-1] 27 | 28 | # Split by variable expressions 29 | parts = re.split(r'(\$\{?\w+\}?)', content) 30 | translated_parts = [ 31 | translate_text(p) if is_chinese(p) else p 32 | for p in parts 33 | ] 34 | return quote + ''.join(translated_parts) + quote 35 | 36 | return re.sub(r'(?:\'[^\']*\'|"[^"]*")', repl, line) 37 | 38 | def translate_file(input_file, output_file): 39 | total_lines = sum(1 for _ in open(input_file, 'r', encoding='utf-8')) 40 | processed_lines = 0 41 | 42 | with open(input_file, 'r', encoding='utf-8') as f_in, \ 43 | open(output_file, 'w', encoding='utf-8') as f_out: 44 | 45 | for line in f_in: 46 | processed_lines += 1 47 | progress = processed_lines / total_lines * 100 48 | print(f"\rProcessing: {progress:.1f}% ({processed_lines}/{total_lines})", end='') 49 | 50 | leading_space = re.match(r'^(\s*)', line).group(1) 51 | stripped = line.strip() 52 | 53 | if stripped.startswith('#') and is_chinese(stripped): 54 | comment_mark = '#' 55 | comment_text = stripped[1:].strip() 56 | if comment_text: 57 | translated = translate_text(comment_text) 58 | f_out.write(f"{leading_space}{comment_mark} {translated}\n") 59 | else: 60 | f_out.write(line) 61 | 62 | elif any(cmd in stripped for cmd in ['echo', 'read', 'send_stats']) and is_chinese(stripped): 63 | translated_line = translate_line_preserving_variables(line) 64 | f_out.write(translated_line) 65 | 66 | else: 67 | f_out.write(line) 68 | 69 | print("\nTranslation completed.") 70 | print(f"Original file size: {os.path.getsize(input_file)} bytes") 71 | print(f"Translated file size: {os.path.getsize(output_file)} bytes") 72 | 73 | if __name__ == "__main__": 74 | input_file = 'kejilion.sh' 75 | output_file = 'kejilion_jp.sh' 76 | translate_file(input_file, output_file) 77 | -------------------------------------------------------------------------------- /kr/to-kr.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | 4 | from deep_translator import GoogleTranslator 5 | import re 6 | import os 7 | 8 | def is_chinese(text): 9 | return bool(re.search(r'[\u4e00-\u9fff]', text)) 10 | 11 | def translate_text(text): 12 | try: 13 | return GoogleTranslator(source='zh-CN', target='ko').translate(text) 14 | except Exception as e: 15 | print(f"\nTranslation error: {e}") 16 | return text 17 | 18 | def translate_line_preserving_variables(line): 19 | """ 20 | Translate only Chinese parts in echo/read/send_stats commands, excluding shell variables 21 | """ 22 | # Match double or single quoted strings 23 | def repl(match): 24 | full_string = match.group(0) 25 | quote = full_string[0] 26 | content = full_string[1:-1] 27 | 28 | # Split by variable expressions 29 | parts = re.split(r'(\$\{?\w+\}?)', content) 30 | translated_parts = [ 31 | translate_text(p) if is_chinese(p) else p 32 | for p in parts 33 | ] 34 | return quote + ''.join(translated_parts) + quote 35 | 36 | return re.sub(r'(?:\'[^\']*\'|"[^"]*")', repl, line) 37 | 38 | def translate_file(input_file, output_file): 39 | total_lines = sum(1 for _ in open(input_file, 'r', encoding='utf-8')) 40 | processed_lines = 0 41 | 42 | with open(input_file, 'r', encoding='utf-8') as f_in, \ 43 | open(output_file, 'w', encoding='utf-8') as f_out: 44 | 45 | for line in f_in: 46 | processed_lines += 1 47 | progress = processed_lines / total_lines * 100 48 | print(f"\rProcessing: {progress:.1f}% ({processed_lines}/{total_lines})", end='') 49 | 50 | leading_space = re.match(r'^(\s*)', line).group(1) 51 | stripped = line.strip() 52 | 53 | if stripped.startswith('#') and is_chinese(stripped): 54 | comment_mark = '#' 55 | comment_text = stripped[1:].strip() 56 | if comment_text: 57 | translated = translate_text(comment_text) 58 | f_out.write(f"{leading_space}{comment_mark} {translated}\n") 59 | else: 60 | f_out.write(line) 61 | 62 | elif any(cmd in stripped for cmd in ['echo', 'read', 'send_stats']) and is_chinese(stripped): 63 | translated_line = translate_line_preserving_variables(line) 64 | f_out.write(translated_line) 65 | 66 | else: 67 | f_out.write(line) 68 | 69 | print("\nTranslation completed.") 70 | print(f"Original file size: {os.path.getsize(input_file)} bytes") 71 | print(f"Translated file size: {os.path.getsize(output_file)} bytes") 72 | 73 | if __name__ == "__main__": 74 | input_file = 'kejilion.sh' 75 | output_file = 'kejilion_kr.sh' 76 | translate_file(input_file, output_file) 77 | -------------------------------------------------------------------------------- /ru/to-ru.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | 4 | from deep_translator import GoogleTranslator 5 | import re 6 | import os 7 | 8 | def is_chinese(text): 9 | return bool(re.search(r'[\u4e00-\u9fff]', text)) 10 | 11 | def translate_text(text): 12 | try: 13 | return GoogleTranslator(source='zh-CN', target='ru').translate(text) 14 | except Exception as e: 15 | print(f"\nTranslation error: {e}") 16 | return text 17 | 18 | def translate_line_preserving_variables(line): 19 | """ 20 | Translate only Chinese parts in echo/read/send_stats commands, excluding shell variables 21 | """ 22 | # Match double or single quoted strings 23 | def repl(match): 24 | full_string = match.group(0) 25 | quote = full_string[0] 26 | content = full_string[1:-1] 27 | 28 | # Split by variable expressions 29 | parts = re.split(r'(\$\{?\w+\}?)', content) 30 | translated_parts = [ 31 | translate_text(p) if is_chinese(p) else p 32 | for p in parts 33 | ] 34 | return quote + ''.join(translated_parts) + quote 35 | 36 | return re.sub(r'(?:\'[^\']*\'|"[^"]*")', repl, line) 37 | 38 | def translate_file(input_file, output_file): 39 | total_lines = sum(1 for _ in open(input_file, 'r', encoding='utf-8')) 40 | processed_lines = 0 41 | 42 | with open(input_file, 'r', encoding='utf-8') as f_in, \ 43 | open(output_file, 'w', encoding='utf-8') as f_out: 44 | 45 | for line in f_in: 46 | processed_lines += 1 47 | progress = processed_lines / total_lines * 100 48 | print(f"\rProcessing: {progress:.1f}% ({processed_lines}/{total_lines})", end='') 49 | 50 | leading_space = re.match(r'^(\s*)', line).group(1) 51 | stripped = line.strip() 52 | 53 | if stripped.startswith('#') and is_chinese(stripped): 54 | comment_mark = '#' 55 | comment_text = stripped[1:].strip() 56 | if comment_text: 57 | translated = translate_text(comment_text) 58 | f_out.write(f"{leading_space}{comment_mark} {translated}\n") 59 | else: 60 | f_out.write(line) 61 | 62 | elif any(cmd in stripped for cmd in ['echo', 'read', 'send_stats']) and is_chinese(stripped): 63 | translated_line = translate_line_preserving_variables(line) 64 | f_out.write(translated_line) 65 | 66 | else: 67 | f_out.write(line) 68 | 69 | print("\nTranslation completed.") 70 | print(f"Original file size: {os.path.getsize(input_file)} bytes") 71 | print(f"Translated file size: {os.path.getsize(output_file)} bytes") 72 | 73 | if __name__ == "__main__": 74 | input_file = 'kejilion.sh' 75 | output_file = 'kejilion_ru.sh' 76 | translate_file(input_file, output_file) 77 | -------------------------------------------------------------------------------- /tw/to-tw.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | 4 | from deep_translator import GoogleTranslator 5 | import re 6 | import os 7 | 8 | def is_chinese(text): 9 | return bool(re.search(r'[\u4e00-\u9fff]', text)) 10 | 11 | def translate_text(text): 12 | try: 13 | return GoogleTranslator(source='zh-CN', target='zh-TW').translate(text) 14 | except Exception as e: 15 | print(f"\nTranslation error: {e}") 16 | return text 17 | 18 | def translate_line_preserving_variables(line): 19 | """ 20 | Translate only Chinese parts in echo/read/send_stats commands, excluding shell variables 21 | """ 22 | # Match double or single quoted strings 23 | def repl(match): 24 | full_string = match.group(0) 25 | quote = full_string[0] 26 | content = full_string[1:-1] 27 | 28 | # Split by variable expressions 29 | parts = re.split(r'(\$\{?\w+\}?)', content) 30 | translated_parts = [ 31 | translate_text(p) if is_chinese(p) else p 32 | for p in parts 33 | ] 34 | return quote + ''.join(translated_parts) + quote 35 | 36 | return re.sub(r'(?:\'[^\']*\'|"[^"]*")', repl, line) 37 | 38 | def translate_file(input_file, output_file): 39 | total_lines = sum(1 for _ in open(input_file, 'r', encoding='utf-8')) 40 | processed_lines = 0 41 | 42 | with open(input_file, 'r', encoding='utf-8') as f_in, \ 43 | open(output_file, 'w', encoding='utf-8') as f_out: 44 | 45 | for line in f_in: 46 | processed_lines += 1 47 | progress = processed_lines / total_lines * 100 48 | print(f"\rProcessing: {progress:.1f}% ({processed_lines}/{total_lines})", end='') 49 | 50 | leading_space = re.match(r'^(\s*)', line).group(1) 51 | stripped = line.strip() 52 | 53 | if stripped.startswith('#') and is_chinese(stripped): 54 | comment_mark = '#' 55 | comment_text = stripped[1:].strip() 56 | if comment_text: 57 | translated = translate_text(comment_text) 58 | f_out.write(f"{leading_space}{comment_mark} {translated}\n") 59 | else: 60 | f_out.write(line) 61 | 62 | elif any(cmd in stripped for cmd in ['echo', 'read', 'send_stats']) and is_chinese(stripped): 63 | translated_line = translate_line_preserving_variables(line) 64 | f_out.write(translated_line) 65 | 66 | else: 67 | f_out.write(line) 68 | 69 | print("\nTranslation completed.") 70 | print(f"Original file size: {os.path.getsize(input_file)} bytes") 71 | print(f"Translated file size: {os.path.getsize(output_file)} bytes") 72 | 73 | if __name__ == "__main__": 74 | input_file = 'kejilion.sh' 75 | output_file = 'kejilion_tw.sh' 76 | translate_file(input_file, output_file) 77 | -------------------------------------------------------------------------------- /TG-check-notify.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # 你需要配置Telegram Bot Token和Chat ID 4 | TELEGRAM_BOT_TOKEN="输入TG的机器人API" 5 | CHAT_ID="输入TG的接收通知的账号ID" 6 | 7 | 8 | # 你可以修改监控阈值设置 9 | CPU_THRESHOLD=70 10 | MEMORY_THRESHOLD=70 11 | DISK_THRESHOLD=70 12 | NETWORK_THRESHOLD_GB=1000 13 | 14 | 15 | 16 | # 获取设备信息的变量 17 | country=$(curl -s ipinfo.io/$public_ip/country) 18 | isp_info=$(curl -s ipinfo.io/org | sed -e 's/\"//g' | awk -F' ' '{print $2}') 19 | 20 | ipv4_address=$(curl -s ipv4.ip.sb) 21 | masked_ip=$(echo $ipv4_address | awk -F'.' '{print "*."$3"."$4}') 22 | 23 | # 发送Telegram通知的函数 24 | send_tg_notification() { 25 | local MESSAGE=$1 26 | curl -s -X POST "https://api.telegram.org/bot$TELEGRAM_BOT_TOKEN/sendMessage" -d "chat_id=$CHAT_ID" -d "text=$MESSAGE" 27 | } 28 | 29 | 30 | # 获取CPU使用率 31 | get_cpu_usage() { 32 | awk '{u=$2+$4; t=$2+$4+$5; if (NR==1){u1=u; t1=t;} else printf "%.0f\n", (($2+$4-u1) * 100 / (t-t1))}' \ 33 | <(grep 'cpu ' /proc/stat) <(sleep 1; grep 'cpu ' /proc/stat) 34 | } 35 | 36 | # 获取内存使用率 37 | get_memory_usage() { 38 | free | awk '/Mem/ {printf("%.0f"), $3/$2 * 100}' 39 | } 40 | 41 | # 获取硬盘使用率 42 | get_disk_usage() { 43 | df / | awk 'NR==2 {print $5}' | sed 's/%//' 44 | } 45 | 46 | # 获取总的接收流量(以 GB 为单位) 47 | get_rx_bytes() { 48 | awk 'BEGIN { rx_total = 0 } 49 | # 匹配常见的公网网卡命名: eth*, ens*, enp*, eno* 50 | $1 ~ /^(eth|ens|enp|eno)[0-9]+/ { rx_total += $2 } 51 | END { 52 | printf("%.2f", rx_total / (1024 * 1024 * 1024)); 53 | }' /proc/net/dev 54 | } 55 | 56 | # 获取总的发送流量(以 GB 为单位) 57 | get_tx_bytes() { 58 | awk 'BEGIN { tx_total = 0 } 59 | # 匹配常见的公网网卡命名: eth*, ens*, enp*, eno* 60 | $1 ~ /^(eth|ens|enp|eno)[0-9]+/ { tx_total += $10 } 61 | END { 62 | printf("%.2f", tx_total / (1024 * 1024 * 1024)); 63 | }' /proc/net/dev 64 | } 65 | 66 | # 检查并发送通知 67 | check_and_notify() { 68 | local USAGE=$1 69 | local TYPE=$2 70 | local THRESHOLD=$3 71 | local CURRENT_VALUE=$4 72 | 73 | if (( $(echo "$USAGE > $THRESHOLD" | bc -l) )); then 74 | send_tg_notification "警告: ${isp_info}-${country}-${masked_ip} 的 $TYPE 使用率已达到 $USAGE%,超过阈值 $THRESHOLD%。" 75 | fi 76 | } 77 | 78 | # 主循环 79 | while true; do 80 | CPU_USAGE=$(get_cpu_usage) 81 | MEMORY_USAGE=$(get_memory_usage) 82 | DISK_USAGE=$(get_disk_usage) 83 | RX_GB=$(get_rx_bytes) 84 | TX_GB=$(get_tx_bytes) 85 | 86 | check_and_notify $CPU_USAGE "CPU" $CPU_THRESHOLD $CPU_USAGE 87 | check_and_notify $MEMORY_USAGE "内存" $MEMORY_THRESHOLD $MEMORY_USAGE 88 | check_and_notify $DISK_USAGE "硬盘" $DISK_THRESHOLD $DISK_USAGE 89 | 90 | # 检查入站流量是否超过阈值 91 | if (( $(echo "$RX_GB > $NETWORK_THRESHOLD_GB" | bc -l) )); then 92 | send_tg_notification "警告: ${isp_info}-${country}-${masked_ip} 的入站流量已达到 ${RX_GB}GB,超过阈值 ${NETWORK_THRESHOLD_GB}GB。" 93 | fi 94 | 95 | # 检查出站流量是否超过阈值 96 | if (( $(echo "$TX_GB > $NETWORK_THRESHOLD_GB" | bc -l) )); then 97 | send_tg_notification "警告: ${isp_info}-${country}-${masked_ip} 的出站流量已达到 ${TX_GB}GB,超过阈值 ${NETWORK_THRESHOLD_GB}GB。" 98 | fi 99 | 100 | # 休眠5分钟 101 | sleep 300 102 | done 103 | -------------------------------------------------------------------------------- /cloudflare.conf: -------------------------------------------------------------------------------- 1 | # 2 | # Author: Mike Rushton 3 | # 4 | # IMPORTANT 5 | # 6 | # Please set jail.local's permission to 640 because it contains your CF API key. 7 | # 8 | # This action depends on curl (and optionally jq). 9 | # Referenced from http://www.normyee.net/blog/2012/02/02/adding-cloudflare-support-to-fail2ban by NORM YEE 10 | # 11 | # To get your CloudFlare API Key: https://www.cloudflare.com/a/account/my-account 12 | # 13 | # CloudFlare API error codes: https://www.cloudflare.com/docs/host-api.html#s4.2 14 | 15 | [Definition] 16 | 17 | # Option: actionstart 18 | # Notes.: command executed on demand at the first ban (or at the start of Fail2Ban if actionstart_on_demand is set to false). 19 | # Values: CMD 20 | # 21 | actionstart = 22 | 23 | # Option: actionstop 24 | # Notes.: command executed at the stop of jail (or at the end of Fail2Ban) 25 | # Values: CMD 26 | # 27 | actionstop = 28 | 29 | # Option: actioncheck 30 | # Notes.: command executed once before each actionban command 31 | # Values: CMD 32 | # 33 | actioncheck = 34 | 35 | # Option: actionban 36 | # Notes.: command executed when banning an IP. Take care that the 37 | # command is executed with Fail2Ban user rights. 38 | # Tags: IP address 39 | # number of failures 40 | #