Skip to content

Commit 92173f3

Browse files
committed
docs(openwrt): add guide for running Telbot on OpenWrt devices
docs(README): update README to include new OpenWrt documentation link
1 parent 8f0e535 commit 92173f3

2 files changed

Lines changed: 105 additions & 2 deletions

File tree

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,10 +90,11 @@ See the [docs/](docs/) folder for detailed guides:
9090
- [Telegram Bot](docs/telegram-bot.md)
9191
- [CLI Mode](docs/cli.md)
9292
- [MCP Server](docs/mcp-server.md)
93-
- [Running as Systemd Service (Linux)](docs/systemd.md)
93+
- [Systemd Service (Linux)](docs/systemd.md)
94+
- [OpenWrt](docs/openwrt.md)
9495
- [OpenClaw Skill](telbot-skills/SKILL.md)
9596

96-
## Disclaimer
97+
## Disclaimer
9798

9899
This project is an unofficial tool that interacts with MyTelkomsel web services for personal automation purposes.
99100

docs/openwrt.md

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
# Running on OpenWrt (ARM)
2+
3+
Telbot can run on ARM-based OpenWrt routers to provide a 24/7 Telegram bot or auto-buy monitor.
4+
5+
## Requirements:
6+
Make sure your are in root user
7+
```bash
8+
ssh root@your-router-ip
9+
```
10+
11+
## 1. Installation
12+
13+
1. SSH into your router and download the ARM binary directly from GitHub:
14+
```bash
15+
wget https://github.com/0xtbug/telbot/releases/latest/download/telbot-linux-arm -O /tmp/telbot
16+
```
17+
2. Move it to `/usr/bin/` and make it executable:
18+
```bash
19+
mv /tmp/telbot /usr/bin/telbot
20+
chmod +x /usr/bin/telbot
21+
```
22+
23+
## 2. Persistent Configuration
24+
25+
Create .env in /root/ directory
26+
27+
```bash
28+
# Create .env in /root/ directory
29+
nano .env
30+
```
31+
32+
Here is the content of .env
33+
```bash
34+
TELKOMSEL_BOT_TOKEN=your_bot_token
35+
TELEGRAM_ADMIN_ID=your_admin_id
36+
```
37+
38+
Then copy .env to /.config/telbot/ directory
39+
```bash
40+
mkdir -p /.config/telbot/
41+
42+
cp /root/.env /.config/telbot/.env
43+
44+
/etc/init.d/telbot restart
45+
```
46+
47+
## 3. Run as a Service (procd)
48+
49+
To ensure Telbot starts automatically and restarts on crashes, create a `procd` init script at `/etc/init.d/telbot`:
50+
51+
```bash
52+
#!/bin/sh /etc/rc.common
53+
54+
USE_PROCD=1
55+
START=99
56+
STOP=10
57+
58+
PROG=/usr/bin/telbot
59+
ENV_FILE=/root/.env
60+
61+
start_service() {
62+
[ -f "$ENV_FILE" ] || {
63+
echo "❌ File $ENV_FILE tidak ditemukan!"
64+
return 1
65+
}
66+
67+
procd_open_instance
68+
69+
procd_set_param chdir "/root"
70+
procd_set_param command "$PROG" --bot --verbose
71+
72+
while IFS= read -r line || [ -n "$line" ]; do
73+
case "$line" in
74+
\#*|"") continue ;;
75+
esac
76+
77+
key=$(echo "$line" | cut -d '=' -f 1)
78+
val=$(echo "$line" | cut -d '=' -f 2- | tr -d '"' | tr -d "'")
79+
80+
procd_set_param env "$key"="$val"
81+
done < "$ENV_FILE"
82+
83+
procd_set_param respawn
84+
procd_set_param stdout 1
85+
procd_set_param stderr 1
86+
procd_close_instance
87+
}
88+
```
89+
90+
Enable and start the service:
91+
```bash
92+
chmod +x /etc/init.d/telbot
93+
/etc/init.d/telbot enable
94+
/etc/init.d/telbot start
95+
```
96+
97+
## 5. Log Monitoring
98+
99+
Check the system logs to see if the bot is running correctly:
100+
```bash
101+
logread -f | grep telbot
102+
```

0 commit comments

Comments
 (0)