Welcome to the 3xui-Ended-Watcher project!
3xui-Ended-Watcher is a lightweight and reliable background watcher designed for 3x-ui panels (specifically tested on v2.3.10). In older releases of 3x-ui,
when a user's traffic limit or time duration expires, the panel disables them in the database, but their live connection remains active and they can continue downloading. If you cannot upgrade your panel to newer versions, this tool fixes that bug completely.
This watcher continuously monitors the panel's database every 5 seconds in read-only mode. When a newly expired client is detected, it gracefully restarts the Xray core to disconnect them instantly — with zero database modifications and no disruption to active valid users.
-
Fixes Connection Bug on Older Panels
Instantly severs connections for users whose volume or duration has expired on older 3x-ui versions. -
Tested on v2.3.10
Specifically verified onv2.3.10(may work on higher versions as well). -
Smart Conditional Restarts
Monitors every 5 seconds, but restarts Xray ONLY when a new ended user is found (no constant restart loops). -
Strict Read-Only Database Queries
Queries/etc/x-ui/x-ui.dbstrictly in-readonlymode without modifying any data or risking database locks. -
Graceful Core Restart
Terminates the child Xray process gently sox-uispawns a fresh core without dropping the entire panel service. -
Smart Baselining on Install
Marks pre-existing expired users during setup to prevent unnecessary restarts after installation. -
One-Command Install & Uninstall
Simple automated bash scripts for effortless deployment and clean removal.
The installation of this watcher is completely automated using a simple one-line script.
Before running the installer, make sure your server meets these conditions:
- Operating System:
UbuntuorDebian- Root Access: Must be run as
rootor withsudoprivileges- Active
3x-uipanel andXraycore service currently running- Database present at
/etc/x-ui/x-ui.db
⚠️ This script has been specifically tested on3x-ui v2.3.10. It may work on higher versions as well, though it has not been officially tested on them.
To install 3xui-Ended-Watcher, simply run the command below on your server:
bash <(curl -fsSL https://raw.githubusercontent.com/TheLeaderDev/3xui-Ended-Watcher/main/install.sh)After installation, you can monitor and manage the watcher using these commands:
-
Check Systemd Timer Status:
systemctl status 3xui-ended-watcher.timer --no-pager
-
Check Detailed Watcher Status:
/usr/local/sbin/3xui-ended-watcher.sh --status
-
View Last 100 Log Lines:
tail -100 /var/log/3xui-ended-watcher.log
-
View Live Real-Time Logs:
tail -f /var/log/3xui-ended-watcher.log
-
Temporarily Disable Watcher:
systemctl disable --now 3xui-ended-watcher.timer
-
Re-enable Watcher:
systemctl enable --now 3xui-ended-watcher.timer -
Verify Timer Schedule (5s Interval):
systemctl list-timers --all | grep 3xui-ended-watcher -
Check Service Journal Logs:
journalctl -u 3xui-ended-watcher.service -n 50 --no-pager
If you wish to completely remove 3xui-Ended-Watcher, run the uninstallation command:
bash <(curl -fsSL https://raw.githubusercontent.com/TheLeaderDev/3xui-Ended-Watcher/main/uninstall.sh)If you liked it, supporting me is completely free — just give this project a Star ⭐
And if you support me, I’ll add even more methods! ❤️
فارسی (کلیک برای باز کردن)
سلام! به پروژه 3xui-Ended-Watcher خوش اومدید.
این پروژه یه راهکار سبک و هوشمند برای رفع باگ قطع نشدن کاربران منقضیشده در پنل 3x-ui (بهویژه نسخه v2.3.10) هست.
تو بعضی نسخههای قدیمیتر پنل، وقتی حجم یا زمان کاربر تموم میشه، پنل اونو غیرفعال میکنه اما اتصال زندهش قطع نمیشه و کاربر همچنان میتونه دانلود داشته باشه. اگه به هر دلیلی مجبورید از نسخههای پایینتر استفاده کنید و امکان آپدیت پنل رو ندارید، این اسکریپت مشکل رو براتون حل میکنه.
این واچر هر ۵ ثانیه دیتابیس رو به صورت Read-Only چک میکنه و فقط زمانی که کاربر جدیدی منقضی بشه، یکبار هسته Xray رو به آرومی ریستارت میکنه تا اتصالش بلافاصله قطع بشه — بدون اینکه دست به دیتابیس بزنه یا خللی تو کار بقیه کاربران ایجاد کنه.
- رفع باگ قطع نشدن کاربران
قطع فوری اتصالات زنده کاربرانی که حجم یا زمانشون تموم شده. - تستشده روی نسخه v2.3.10
تست کامل روی نسخهv2.3.10پنل (احتمال کارکرد روی نسخههای بالاتر). - ریستارت هوشمند و شرطی
پایش هر ۵ ثانیه یکبار در پسزمینه، اما ریستارت Xray فقط موقع پیدا شدن کاربر منقضیشده جدید. - کاملاً ایمن (Read-Only)
اطلاعات دیتابیس فقط خونده میشه و هیچ تغییری تو دیتابیس یا پنل ایجاد نمیشه. - ریستارت ملایم هسته Xray
بستن پروسس فرزند Xray تا پنل بلافاصله هسته جدید بالا بیاره بدون قطعی کامل پنل. - بیسلاین هوشمند هنگام نصب
علامتگذاری کاربران منقضیشده قدیمی در زمان نصب برای جلوگیری از ریستارتهای بیمورد. - نصب و حذف تکدستوری
راهاندازی و پاکسازی بسیار راحت و سریع تنها با اجرای یک دستور ساده.
نصب این واچر کاملاً خودکاره.
فقط مطمئن بشید موارد زیر رو دارید:
- سیستمعاملUbuntuیاDebian
- دسترسیroot
- سرویسx-uiو هستهXrayدر حال اجرا
- دیتابیس در مسیر/etc/x-ui/x-ui.db
⚠️ این اسکریپت روی نسخهv2.3.10تست شده.
برای نصب کافیه این دستور رو اجرا کنید:
bash <(curl -fsSL https://raw.githubusercontent.com/TheLeaderDev/3xui-Ended-Watcher/main/install.sh)بعد از نصب میتونی از دستورات زیر برای بررسی وضعیت، مشاهده لاگها یا مدیریت سرویس استفاده کنی:
بررسی وضعیت تایمر سیستمd:
systemctl status 3xui-ended-watcher.timer --no-pagerبررسی وضعیت کامل واچر:
/usr/local/sbin/3xui-ended-watcher.sh --statusمشاهده ۱۰۰ سطر آخر لاگ:
tail -100 /var/log/3xui-ended-watcher.logمشاهده لاگ به صورت زنده:
tail -f /var/log/3xui-ended-watcher.logغیرفعالسازی موقت واچر:
systemctl disable --now 3xui-ended-watcher.timerفعالسازی مجدد واچر:
systemctl enable --now 3xui-ended-watcher.timerبررسی زمانبندی اجرای هر ۵ ثانیه:
systemctl list-timers --all | grep 3xui-ended-watcherبررسی ژورنال سرویس:
journalctl -u 3xui-ended-watcher.service -n 50 --no-pagerاگر به هر دلیلی خواستید این اسکریپت رو به طور کامل از سرور پاک کنید، کافیه دستور زیر رو اجرا کنید:
bash <(curl -fsSL https://raw.githubusercontent.com/TheLeaderDev/3xui-Ended-Watcher/main/uninstall.sh)اگه این پروژه رو دوست داشتید، فقط بهش یه ستاره ⭐ بدید ❤️
