Remote command wrapper and monitoring tool for Telegram
Project description
๐ค Telewrapperz
Remote command monitoring made simple โ Execute any command and get real-time updates directly on Telegram with live system stats.
โจ Features
| Feature | Description |
|---|---|
| ๐ Live Dashboard | Single auto-updating Telegram message with command output |
| ๐ฅ๏ธ System Monitoring | Real-time CPU, RAM usage tracking |
| ๐ฎ GPU Support | NVIDIA GPU utilization & VRAM stats (via pynvml) |
| ๐ Multi-Host Ready | Run on multiple machines with the same bot token |
| โฑ๏ธ Execution Timer | Track how long your commands have been running |
| ๐๏ธ Remote Control | Terminate processes or close wrapper via inline buttons |
| ๐ฅ๏ธ Cross-Platform | Works on Windows, macOS, and Linux |
| ๐ Progress Bar Support | Smart handling of tqdm and rich progress bars, with proper terminal emulation |
| ๐พ Log Saving | Use --log to automatically save the full command output locally and download it via Telegram |
๐ฆ Installation
# Clone the repository
git clone https://github.com/duccioo/telewrapper.git
cd telewrapper
# Install the package
pip install .
# Development install, useful when editing this checkout
pip install -e .
Dependencies: Automatically installed via pip
python-telegram-bot>=20.0psutilpynvml(optional, for NVIDIA GPU stats)rich(used by the long progress demo and supported command output)
โ๏ธ Configuration
Option 1: Environment Variables (Recommended)
export TELEGRAM_TOKEN="your_bot_token_here"
export TELEGRAM_CHAT_ID="your_chat_id_here"
Option 2: Command Line Arguments
telewrapperz --token "your_token" --chat_id "your_chat_id" "your_command"
Option 3: Config File (YAML or INI)
Create a config file and pass it with --config:
YAML format (recommended):
telegram:
token: your_bot_token_here
chat_id: your_chat_id_here
settings:
update_interval: 5.0 # seconds between dashboard updates
enable_log: true # save full output and enable the Telegram download button
INI format (legacy):
[Telegram]
token = your_bot_token_here
chat_id = your_chat_id_here
[Settings]
update_interval = 5.0
enable_log = true
You can also enable persistent log files with an environment variable:
export TELEWRAPPERZ_ENABLE_LOG=true
๐ Usage
Basic Usage
# Run any command
telewrapperz "python train.py"
# Run a long-running script
telewrapperz "python -u my_training_script.py --epochs 100"
# Save the full output locally and show a "Download Log" button
telewrapperz --log "python -u my_training_script.py --epochs 100"
# Test your bot connection
telewrapperz --test
Progress Bar Demo
The repository includes a longer local demo that exercises different terminal output styles:
- plain log lines
- carriage-return spinners
- single-line progress bars
- training-style progress bars with metrics
- multi-line cursor-up dashboards
- Rich progress bars with multiple concurrent tasks
Run it directly:
python test/long_test.py
Run it through Telewrapperz:
telewrapperz --config config.yaml "python test/long_test.py"
For live progress demos, keep settings.update_interval low, for example 5.0. Higher values such as 60.0 reduce Telegram traffic but may make short commands appear stuck on the initial Starting... message until the next update or the final forced refresh.
What You'll See on Telegram
๐ฅ MacBook-Pro (PID: 12345)
โ๏ธ python train.py
Status: ๐ข Running
Time: 1:23:45
CPU: 45% | RAM: 62%
GPU 0: 87% | VRAM: 8.2/24.0GB (34%)
๐ Recent Log (Last 50):
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Epoch 15/100
โ Loss: 0.0234, Accuracy: 98.7%
โ Validation: 97.2%
โ ...
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
[๐ Refresh] [๐ Terminate Process]
๐๏ธ Architecture
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Telewrapperz โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ โ
โ โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ โ
โ โ Command โโโโโโถโ Log Buffer โ โ
โ โ Process โ โ (Last 50 lines)โ โ
โ โโโโโโโโโโโโโโโ โโโโโโโโโโฌโโโโโโโโโ โ
โ โ โ
โ โโโโโโโโโโโโโโโ โ โ
โ โ System โ โ โ
โ โ Monitor โโโโโโโโโโโโโโโโค โ
โ โ (CPU/RAM/GPU) โ โ
โ โโโโโโโโโโโโโโโ โ โ
โ โผ โ
โ โโโโโโโโโโโโโโโโโโโ โ
โ โ Telegram โ โ
โ โ Dashboard โ โ
โ โ (Auto-update) โ โ
โ โโโโโโโโโโโโโโโโโโโ โ
โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
๐ Command Line Options
| Option | Description |
|---|---|
command |
The command to execute (wrap in quotes) |
--token |
Telegram Bot Token |
--chat_id |
Telegram Chat ID |
--config |
Path to configuration file |
--log |
Save full command output to a file and enable download button |
--test |
Run a connection test |
๐พ Log Files
Full log files are disabled by default unless you pass --log, set settings.enable_log: true, or export TELEWRAPPERZ_ENABLE_LOG=true.
When enabled, Telewrapperz writes logs to:
telewrapperz_log/telewrapperz_YYYYMMDD_HHMMSS.log
The Telegram dashboard also shows a Scarica Log / Download Log button while that file exists.
๐ง How to Get Your Telegram Credentials
1. Create a Bot Token
- Open Telegram and search for @BotFather
- Send
/newbotand follow the instructions - Copy the token provided
2. Get Your Chat ID
- Start a chat with your new bot
- Send any message to the bot
- Visit:
https://api.telegram.org/bot<YOUR_TOKEN>/getUpdates - Look for
"chat":{"id":XXXXXXXX}โ that's your Chat ID
๐ก Tips & Best Practices
- ๐ Use
python -ufor unbuffered Python output - ๐ The dashboard shows the last 50 lines of output
- โฐ Dashboard updates every 5 seconds (configurable via
update_interval) - ๐ฅ๏ธ GPU stats only appear if NVIDIA GPU is detected
- ๐ Use the Refresh button for immediate updates
- ๐ Progress bars (
tqdm,rich, carriage-return bars, and simple cursor-up dashboards) are handled by the log buffer - ๐ค Run only one active Telewrapperz polling instance per Telegram bot token. Telegram will raise
Conflict: terminated by other getUpdates requestif two wrappers poll the same bot at once, which can break inline buttons.
๐ฅ๏ธ Platform Support
| Platform | Terminal Emulation | Notes |
|---|---|---|
| Linux | PTY (full) | Best support, native terminal emulation |
| macOS | PTY (full) | Native terminal emulation |
| Windows | PIPE | Subprocess with line-buffered output |
๐ License
This project is licensed under the MIT License - see the LICENSE file for details.
Made with โค๏ธ for remote monitoring
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file telewrapperz-0.1.0.tar.gz.
File metadata
- Download URL: telewrapperz-0.1.0.tar.gz
- Upload date:
- Size: 17.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a15eeebf8b7c5c8357d02efcc3a0da3c0b0627ed094bd345b3bb7c9ca27c3aa0
|
|
| MD5 |
a6ee0233d59ab20dd338a586f0643bd1
|
|
| BLAKE2b-256 |
6aa607af60ecb934eeeafee2071a99085c0dd347d34919fd22bc61e45d74d6e7
|
File details
Details for the file telewrapperz-0.1.0-py3-none-any.whl.
File metadata
- Download URL: telewrapperz-0.1.0-py3-none-any.whl
- Upload date:
- Size: 14.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e4dae13516c1147c60a9d01b0fa92c1ae6df186a81b3734e1125381588042083
|
|
| MD5 |
1a11dbc7b5ba0472bd3c727b6da44250
|
|
| BLAKE2b-256 |
380ad891b0b5714e4befe4f0c2574c77fa1a572f1cbdb1022d59982cc555d77a
|