Skip to content

Latest commit

 

History

14 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 

Repository files navigation

ترجمه فارسی

3xui-Ended-Watcher

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,

SecureInputs Preview

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.

Features

  • 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 on v2.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.db strictly in -readonly mode without modifying any data or risking database locks.

  • Graceful Core Restart
    Terminates the child Xray process gently so x-ui spawns 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.

Before You Install

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: Ubuntu or Debian
  • Root Access: Must be run as root or with sudo privileges
  • Active 3x-ui panel and Xray core service currently running
  • Database present at /etc/x-ui/x-ui.db

⚠️ This script has been specifically tested on 3x-ui v2.3.10. It may work on higher versions as well, though it has not been officially tested on them.

Installation

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)

Maintenance Commands

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

Remove

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)

Give a Star

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! ❤️

Instagram telegram LinkedIn


فارسی (کلیک برای باز کردن)

3xui-Ended-Watcher

سلام! به پروژه 3xui-Ended-Watcher خوش اومدید.
این پروژه یه راهکار سبک و هوشمند برای رفع باگ قطع نشدن کاربران منقضی‌شده در پنل 3x-ui (به‌ویژه نسخه v2.3.10) هست.

SecureInputs Preview


تو بعضی نسخه‌های قدیمی‌تر پنل، وقتی حجم یا زمان کاربر تموم میشه، پنل اونو غیرفعال می‌کنه اما اتصال زنده‌ش قطع نمیشه و کاربر همچنان می‌تونه دانلود داشته باشه. اگه به هر دلیلی مجبورید از نسخه‌های پایین‌تر استفاده کنید و امکان آپدیت پنل رو ندارید، این اسکریپت مشکل رو براتون حل می‌کنه.

این واچر هر ۵ ثانیه دیتابیس رو به صورت 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)

حمایت از پروژه

اگه این پروژه رو دوست داشتید، فقط بهش یه ستاره ⭐ بدید ❤️

Instagram telegram LinkedIn

About

Fix the active connection bug on older 3x-ui panels. A lightweight watcher that checks client expiry every 5 seconds and gracefully restarts Xray only when an account ends to instantly kill expired connections. 100% safe, read-only, and non-disruptive.

Resources

Stars

3 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages