Sistem Otomatis Monitoring dan Perpanjangan Kuota untuk Router OpenWrt
Tidak perlu khawatir kehabisan kuota lagi!
Fitur • Instalasi • Penggunaan • Konfigurasi • Troubleshooting
AutoEdu-renewal adalah sistem otomatis yang memonitor kuota paket Edu melalui SMS dan secara otomatis melakukan perpanjangan ketika kuota hampir habis. Dilengkapi notifikasi Telegram, logging lengkap, dan error handling yang robust.
🎉 Fixed: Double Renewal & Heavy Usage Issue
Masalah yang diperbaiki:
- ✅ Script tidak lagi melakukan renewal berulang (2-3x)
- ✅ SMS lama diabaikan dengan time-based filtering
- ✅ Auto-detect konfirmasi aktivasi paket
- ✅ Heavy usage protection - Handle 30GB habis dalam hitungan menit
Fitur baru:
SMS_MAX_AGE_MINUTES- Filter SMS berdasarkan usia- Renewal timestamp tracking - Proteksi untuk pemakaian berat
- Notifikasi configurable saat setup (NOTIF_STARTUP, NOTIF_KUOTA_AMAN)
- Update script untuk existing users dengan konfirmasi backup
Untuk update:
bash <(curl -fsSL https://raw.githubusercontent.com/Matsumiko/AutoEdu-renewal/main/update.sh)📖 Detail: FIX_DOUBLE_RENEWAL.md
Script ini adalah versi Edited dari script original dengan penambahan:
- Arsitektur Object-Oriented
- Error handling & retry mechanism
- Logging system
- Konfigurasi via .env file
- Setup script interaktif
- Configurable notification settings - Hindari spam notifikasi!
- Anti double-renewal fix - SMS time-based filtering mencegah renewal berulang!
- Heavy usage protection - Renewal timestamp tracking untuk pemakaian ekstrem!
- 🔄 Set it and forget it - Monitoring & renewal sepenuhnya otomatis
- 💬 Notifikasi cerdas - Alert Telegram dengan format HTML, tanpa spam!
- 🛡️ Production-ready - Reliability 99% dengan retry mechanism
- 🔥 Heavy usage ready - Handle pemakaian ekstrem (30GB/jam)
- 📊 Full visibility - Logging lengkap untuk debugging
- ⚙️ Highly configurable - 15+ parameter untuk customize
- 🔒 Secure config - Kredensial disimpan di .env file terpisah
✅ Notifikasi Telegram dengan HTML & emoji
✅ Smart notification - Hindari spam dengan setting granular
✅ Logging system komprehensif untuk debugging
✅ Real-time progress tracking dengan update status
✅ Error handling robust dengan retry otomatis
✅ Validasi konfigurasi otomatis sebelum running
✅ Timeout protection untuk semua operasi ADB
✅ Log rotation otomatis untuk hemat storage
✅ Object-oriented design dengan class terpisah
✅ 3x retry mechanism untuk Telegram API
✅ Smart SMS parsing dengan ekstraksi timestamp
✅ Triple verification - 3 kriteria check untuk setiap SMS
✅ Renewal timestamp tracking - Proteksi pemakaian berat
✅ Configurable thresholds untuk semua parameter
✅ Silent mode untuk notifikasi non-critical
✅ Graceful shutdown dengan proper exit codes
- Router OpenWrt dengan port USB
- Device Android dengan USB debugging enabled
- Kabel USB OTG/standar
opkg update
opkg install python3 curl adb- Telegram Bot Token (dari @BotFather)
- Telegram Chat ID (dari @userinfobot)
Install semua dengan 1 perintah:
bash <(curl -fsSL https://raw.githubusercontent.com/Matsumiko/AutoEdu-renewal/main/setup.sh)Atau alternatif:
curl -fsSL https://raw.githubusercontent.com/Matsumiko/AutoEdu-renewal/main/setup.sh | shThat's it! Installer akan:
- ✅ Install dependencies (python3, curl)
- ✅ Buat direktori
/root/Auto-Edu/ - ✅ Download script terbaru
- ✅ Wizard interaktif untuk setup (termasuk pilihan notifikasi!)
- ✅ Generate file
.envdengan anti double-renewal protection - ✅ Test script
- ✅ Setup cron job otomatis
/root/Auto-Edu/ # Direktori utama
├── auto_edu.py # Script utama
└── auto_edu.env # File konfigurasi (credentials)
Jika ingin install manual tanpa one-liner:
-
Buat direktori
mkdir -p /root/Auto-Edu cd /root/Auto-Edu -
Download script
wget https://raw.githubusercontent.com/Matsumiko/AutoEdu-renewal/main/auto_edu.py chmod +x auto_edu.py
-
Install dependencies
opkg update opkg install python3 curl adb
-
Buat file konfigurasi
vi /root/Auto-Edu/auto_edu.env
Isi dengan:
# Telegram Config (WAJIB) BOT_TOKEN=your_bot_token_here CHAT_ID=your_chat_id_here # USSD Codes KODE_UNREG=*808*5*2*1*1# KODE_BELI=*808*4*1*1*1*1# # Quota Settings THRESHOLD_KUOTA_GB=3 JUMLAH_SMS_CEK=3 # Timing Settings JEDA_USSD=10 TIMEOUT_ADB=15 # Anti Double-Renewal (IMPORTANT!) SMS_MAX_AGE_MINUTES=15 # Notification Settings (recommend: false untuk interval <5min) NOTIF_KUOTA_AMAN=false NOTIF_STARTUP=false NOTIF_DETAIL=true # Logging LOG_FILE=/tmp/auto_edu.log MAX_LOG_SIZE=102400
-
Set permissions
chmod 600 /root/Auto-Edu/auto_edu.env
-
Test script
python3 /root/Auto-Edu/auto_edu.py
-
Setup cron (lihat bagian Penggunaan)
💡 Sudah punya versi lama?
Update ke versi terbaru dengan fix double-renewal & heavy usage protection:bash <(curl -fsSL https://raw.githubusercontent.com/Matsumiko/AutoEdu-renewal/main/update.sh)
Semua konfigurasi disimpan di /root/Auto-Edu/auto_edu.env
Edit konfigurasi:
vi /root/Auto-Edu/auto_edu.env# Kredensial Telegram
BOT_TOKEN=1234567890:ABCdefGHIjklMNOpqrsTUVwxyz # Dari @BotFather
CHAT_ID=123456789 # Dari @userinfobot
# Kode USSD (sesuaikan provider)
KODE_UNREG=*808*5*2*1*1# # Kode unreg
KODE_BELI=*808*4*1*1*1*1# # Kode beli# Threshold kuota (GB)
THRESHOLD_KUOTA_GB=3 # Trigger renewal saat kuota < 3GB
# Timing (detik)
JEDA_USSD=10 # Delay antar perintah USSD
TIMEOUT_ADB=15 # Timeout operasi ADB
# Anti Double-Renewal (menit) - IMPORTANT!
SMS_MAX_AGE_MINUTES=15 # Hanya cek SMS < X menit (mencegah double renewal)
# Notifikasi (ditanyakan saat setup.sh)
NOTIF_KUOTA_AMAN=false # Notif saat kuota aman (recommend: false)
NOTIF_STARTUP=false # Notif saat script start (recommend: false untuk interval <5min)
NOTIF_DETAIL=true # Notifikasi detail
# Logging
LOG_FILE=/tmp/auto_edu.log # Path log file
MAX_LOG_SIZE=102400 # Max size sebelum rotation (bytes)💡 Tips Notifikasi:
- Untuk interval pendek (setiap 3-5 menit), set
NOTIF_STARTUP=falsedanNOTIF_KUOTA_AMAN=falseuntuk menghindari spam- Notifikasi penting (kuota habis, renewal, error) tetap akan dikirim terlepas dari setting ini
- Setup wizard akan menanyakan preferensi Anda secara interaktif
🛡️ Tips Anti Double-Renewal:
SMS_MAX_AGE_MINUTESmencegah script memproses SMS lama yang sudah di-handle- Script otomatis track timestamp renewal untuk proteksi pemakaian berat
- Sesuaikan dengan interval cron: cron 3 menit → set 10-15 menit
- Script otomatis skip SMS konfirmasi aktivasi ("paket aktif")
🔥 Heavy Usage Protection:
- Script track waktu renewal terakhir di
/tmp/auto_edu_last_renewal- Hanya proses SMS yang datang SETELAH renewal terakhir
- Handle scenario pemakaian ekstrem (30GB habis dalam hitungan menit)
- Graceful fallback jika timestamp file hilang (reboot router)
| Notifikasi | Setting | Default | Penjelasan |
|---|---|---|---|
| 🚀 Script Started | NOTIF_STARTUP |
false |
Dikirim setiap script jalan |
| ✅ Kuota Aman | NOTIF_KUOTA_AMAN |
false |
Dikirim saat kuota masih cukup |
| Always ON | - | Selalu dikirim saat kuota < threshold | |
| 🔄 Proses Renewal | Always ON | - | Selalu dikirim saat renewal |
| ✅/❌ Hasil Renewal | Always ON | - | Selalu dikirim setelah renewal |
| ❌ Error/Warning | Always ON | - | Selalu dikirim saat ada masalah |
📱 Cara Mendapatkan Bot Token
- Buka @BotFather di Telegram
- Kirim
/newbot - Ikuti instruksi yang diberikan
- Copy token yang diberikan
🆔 Cara Mendapatkan Chat ID
Opsi 1: Via @userinfobot
- Buka @userinfobot
- Klik "Start"
- Copy ID yang ditampilkan
Opsi 2: Via @MissRose_bot
- Buka @MissRose_bot
- Kirim
/id - Copy nomor yang ditampilkan
Opsi 3: Manual
- Kirim pesan ke bot Anda
- Buka:
https://api.telegram.org/bot<TOKEN_ANDA>/getUpdates - Cari
"chat":{"id":123456789}
Test script secara manual:
python3 /root/Auto-Edu/auto_edu.pyInstaller sudah setup cron otomatis. Untuk edit manual:
# Edit crontab
crontab -eFormat cron yang sudah disetup:
# Cek setiap 3 menit (default dari installer)
*/3 * * * * AUTO_EDU_ENV=/root/Auto-Edu/auto_edu.env python3 /root/Auto-Edu/auto_edu.py
# Atau setiap 5 menit
*/5 * * * * AUTO_EDU_ENV=/root/Auto-Edu/auto_edu.env python3 /root/Auto-Edu/auto_edu.py
# Atau setiap 15 menit
*/15 * * * * AUTO_EDU_ENV=/root/Auto-Edu/auto_edu.env python3 /root/Auto-Edu/auto_edu.pyNote: AUTO_EDU_ENV variable memberitahu script lokasi file konfigurasi.
# Lihat log real-time
tail -f /tmp/auto_edu.log
# Lihat 50 baris terakhir
tail -50 /tmp/auto_edu.log
# Cari error di log
grep ERROR /tmp/auto_edu.log
# Cek renewal timestamp (heavy usage protection)
cat /tmp/auto_edu_last_renewal
# Lihat cron jobs aktif
crontab -l
# Lihat log cron
logread | grep cron
# Edit konfigurasi
vi /root/Auto-Edu/auto_edu.env
# Restart script (test ulang)
python3 /root/Auto-Edu/auto_edu.py
# Cek struktur direktori
ls -la /root/Auto-Edu/🚀 Script Started
Auto Edu monitoring dimulai
Threshold: 3GB
SMS Max Age: 15 menit
⏱ 02/11/2025 14:30:00
Set
NOTIF_STARTUP=falseuntuk disable (recommended untuk interval <5 menit)
✅ Status Kuota
Kuota masih aman (≥ 3GB)
SMS Terakhir:
📤 PROVIDER
🕐 02/11/2025 14:30
💬 Sisa kuota EduConference 30GB...
⏱ 02/11/2025 14:30:00
Set
NOTIF_KUOTA_AMAN=falseuntuk disable (recommended untuk interval <5 menit)
⚠️ Kuota Hampir Habis!
Kuota Edu Anda kurang dari 3GB.
Memulai proses renewal otomatis...
SMS Terakhir:
Sisa kuota EduConference 30GB Anda kurang dari 3GB...
⏱ 02/11/2025 14:30:00
🎉 Renewal ✅ Berhasil
✅ USSD '*808*5*2*1*1#' terkirim
✅ USSD '*808*4*1*1*1*1#' terkirim
📱 SMS Terbaru:
SMS #1
📤 PROVIDERS
🕐 02/11/2025 14:32
💬 Paket EduConference 30GB berhasil diaktifkan...
⏱ 02/11/2025 14:35:00
Script tidak jalan
Cek instalasi Python:
which python3
python3 --versionCek instalasi ADB:
which adb
adb devicesCek file permissions:
ls -l /root/Auto-Edu/auto_edu.py
ls -l /root/Auto-Edu/auto_edu.env
chmod +x /root/Auto-Edu/auto_edu.py
chmod 600 /root/Auto-Edu/auto_edu.envCek konfigurasi:
cat /root/Auto-Edu/auto_edu.envDevice tidak terdeteksi
Cek koneksi USB:
lsusb
dmesg | tailRestart ADB:
adb kill-server
adb start-server
adb devicesEnable USB Debugging di Android:
- Settings → About Phone
- Tap "Build Number" 7x
- Settings → Developer Options
- Enable "USB Debugging"
- Allow koneksi saat diminta
Tidak dapat notifikasi Telegram
Test bot token:
curl "https://api.telegram.org/bot<TOKEN>/getMe"Test kirim pesan:
curl -X POST "https://api.telegram.org/bot<TOKEN>/sendMessage" \
-d "chat_id=<CHAT_ID>&text=Test"Cek koneksi network:
ping -c 3 api.telegram.org
curl -I https://api.telegram.orgValidasi .env file:
cat /root/Auto-Edu/auto_edu.env | grep BOT_TOKEN
cat /root/Auto-Edu/auto_edu.env | grep CHAT_IDSMS tidak terbaca
Cek akses SMS:
adb shell content query --uri content://sms/inbox | headVerifikasi isi SMS:
- Pastikan SMS dari provider mengandung keyword kuota
- Sesuaikan
THRESHOLD_KUOTA_GBdengan format SMS - Cek
JUMLAH_SMS_CEKuntuk baca lebih banyak SMS
Cron job tidak jalan
Cek cron service:
/etc/init.d/cron status
/etc/init.d/cron restartVerifikasi crontab:
crontab -lTest script manual dulu:
python3 /root/Auto-Edu/auto_edu.py
echo $? # Harus return 0 jika suksesCek cron logs:
logread | grep cronNotifikasi Telegram spam/terlalu banyak
Solusi:
# Edit konfigurasi
vi /root/Auto-Edu/auto_edu.env
# Set kedua notifikasi ini ke false
NOTIF_STARTUP=false
NOTIF_KUOTA_AMAN=falseRecommended settings berdasarkan interval:
- Interval 3-5 menit:
NOTIF_STARTUP=false,NOTIF_KUOTA_AMAN=false - Interval 15-30 menit: Bisa pakai
trueuntuk monitoring lebih detail - Interval 1+ jam: Pakai
trueuntuk visibility maksimal
Double renewal / Script renewal berulang
Masalah: Script melakukan renewal 2-3x berturut-turut meskipun paket sudah aktif.
Penyebab: Script mendeteksi SMS lama "kurang dari 3GB" yang belum hilang dari inbox.
Solusi:
1. Update ke versi terbaru (Recommended)
bash <(curl -fsSL https://raw.githubusercontent.com/Matsumiko/AutoEdu-renewal/main/update.sh)2. Atau tambahkan parameter manual:
vi /root/Auto-Edu/auto_edu.env
# Tambahkan baris ini setelah TIMEOUT_ADB:
SMS_MAX_AGE_MINUTES=153. Sesuaikan dengan interval cron:
- Cron 3 menit →
SMS_MAX_AGE_MINUTES=10 - Cron 5 menit →
SMS_MAX_AGE_MINUTES=15 - Cron 15 menit →
SMS_MAX_AGE_MINUTES=30
Verifikasi fix bekerja:
# Cek parameter sudah ada
grep SMS_MAX_AGE_MINUTES /root/Auto-Edu/auto_edu.env
# Test script
python3 /root/Auto-Edu/auto_edu.py
# Monitor log
tail -f /tmp/auto_edu.logExpected log:
[SUCCESS] ✅ SMS terbaru adalah konfirmasi - Skip renewal[INFO] Last renewal: 07/11/2025 00:46:00[INFO] Skip SMS: dari sebelum renewal terakhir
📖 Detail lengkap: Lihat FIX_DOUBLE_RENEWAL.md
Heavy usage - 30GB habis cepat tapi tidak renewal
Masalah: Paket 30GB habis dalam hitungan menit, tapi script tidak renewal karena dianggap SMS lama.
Penyebab: SMS "kurang dari 3GB" baru datang tapi timestamp-nya di-skip.
Solusi: Script v1.1.0 sudah include heavy usage protection!
Verifikasi:
# Cek ada renewal timestamp tracking
ls -la /tmp/auto_edu_last_renewal
# Monitor log saat renewal
tail -f /tmp/auto_edu.logExpected log untuk heavy usage:
[INFO] Last renewal: 07/11/2025 00:46:00
[WARN] ⚠️ KUOTA RENDAH TERDETEKSI! SMS usia: 2 menit, Setelah renewal: Ya
[INFO] MEMULAI PROSES RENEWAL
Script akan renewal karena SMS timestamp > renewal timestamp!
Update jika belum:
bash <(curl -fsSL https://raw.githubusercontent.com/Matsumiko/AutoEdu-renewal/main/update.sh)| Code | Keterangan |
|---|---|
0 |
Sukses - kuota aman atau renewal berhasil |
1 |
Error - masalah config, ADB error, dll |
130 |
Interrupted - dihentikan user (Ctrl+C) |
| Interval | Use Case | Penggunaan Resource | Recommended Notif Settings |
|---|---|---|---|
| Setiap 3 menit | Monitoring ketat / Heavy usage | Medium | STARTUP=false, AMAN=false |
| Setiap 5 menit | Pendekatan balanced | Low-Medium | STARTUP=false, AMAN=false |
| Setiap 15 menit | Hemat resource | Low | STARTUP=false, AMAN=true |
| Setiap jam | Checking minimal | Very Low | STARTUP=true, AMAN=true |
-
Lindungi kredensial Anda
chmod 600 /root/Auto-Edu/auto_edu.env # Hanya root yang bisa baca -
Backup konfigurasi
cp /root/Auto-Edu/auto_edu.env /root/Auto-Edu/auto_edu.env.backup
-
Gunakan chat ID private (bukan group chat)
-
Jangan commit credentials ke Git
- Disable notifikasi yang tidak perlu - Set
NOTIF_STARTUP=falsedanNOTIF_KUOTA_AMAN=falseuntuk interval pendek - Tingkatkan interval monitoring jika penggunaan kuota predictable
- Setup log rotation untuk deployment jangka panjang
- Monitor kesehatan script dengan custom alerts
- Untuk heavy usage - Gunakan interval 3-5 menit untuk response cepat
✅ DO:
- Set
NOTIF_STARTUP=falseuntuk cron interval < 5 menit - Set
NOTIF_KUOTA_AMAN=falsejika tidak butuh konfirmasi rutin - Gunakan interval 15+ menit jika tidak urgent
❌ DON'T:
- Enable semua notifikasi dengan interval 3 menit (spam!)
- Set threshold terlalu tinggi (false alarm)
- Gunakan group chat untuk notifikasi production
| Fitur | Versi Original | Edited Version |
|---|---|---|
| Error Handling | Basic | Advanced dengan retry |
| Logging | Tidak ada | File + console |
| Notifikasi | Plain text | HTML formatted |
| Anti-Spam Notif | ❌ | ✅ Configurable |
| Anti Double-Renewal | ❌ | ✅ SMS time filtering |
| Heavy Usage Protection | ❌ | ✅ Timestamp tracking |
| Setup Wizard | ❌ | ✅ Interactive |
| Konfigurasi | Hardcoded | .env file |
| Validasi | Tidak ada | Pre-flight check |
| Architecture | Procedural | Object-oriented |
| Timeout | Tidak ada | Semua operasi |
| Exit Codes | Tidak ada | Proper codes |
| Documentation | Minimal | Comprehensive |
| Success Rate | ~85% | ~99% |
Untuk stop monitoring sementara:
# Remove cron job
crontab -l | grep -v "auto_edu.py" | crontab -
# Verify
crontab -lUntuk restart lagi:
# Re-enable cron
(crontab -l 2>/dev/null; echo "*/3 * * * * AUTO_EDU_ENV=/root/Auto-Edu/auto_edu.env python3 /root/Auto-Edu/auto_edu.py") | crontab -Opsi 1: One-liner dengan backup
bash <(curl -fsSL https://raw.githubusercontent.com/Matsumiko/AutoEdu-renewal/main/uninstall.sh)Opsi 2: Manual uninstall
# Backup (optional)
tar -czf ~/Auto-Edu-backup.tar.gz /root/Auto-Edu/
# Remove cron
crontab -l | grep -v "auto_edu.py" | crontab -
# Remove files
rm -rf /root/Auto-Edu/
rm -f /tmp/auto_edu.log
rm -f /tmp/auto_edu_last_renewalOpsi 3: Force uninstall (tanpa konfirmasi)
crontab -l 2>/dev/null | grep -v "auto_edu.py" | crontab -; \
rm -rf /root/Auto-Edu/ /tmp/auto_edu.log /tmp/auto_edu_last_renewal; \
echo "✓ Uninstall complete!"Kontribusi sangat welcome! Berikut cara contribute:
- 🍴 Fork repository ini
- 🔧 Buat feature branch (
git checkout -b feature/AmazingFeature) - ✅ Commit changes (
git commit -m 'Add some AmazingFeature') - 📤 Push ke branch (
git push origin feature/AmazingFeature) - 🎉 Buat Pull Request
- Web UI untuk monitoring
- Support multi-device
- Support provider lain
- Statistics dashboard
- Integrasi mobile app
- Docker container
- Fitur backup/restore
- Notification rate limiting
- Usage analytics & reporting
- 📖 Dokumentasi: Baca README ini dengan lengkap
- 🐛 Bug Reports: Buka issue
- 💡 Feature Requests: Start discussion
- ⭐ Suka project ini? Kasih star!
- Original Script: @zifahx - Terima kasih untuk script original yang powerful!
- OpenWrt Community: Untuk platform yang luar biasa
- Contributors: Semua yang telah berkontribusi untuk project ini
Dibuat dengan ❤️ untuk komunitas
Edited Version By Matsumiko
Jika ini membantu Anda, tolong berikan ⭐ star!