Remote command monitoring made simple โ Execute any command and get real-time updates directly on Telegram with live system stats.
| 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 |
# 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)
export TELEGRAM_TOKEN="your_bot_token_here"
export TELEGRAM_CHAT_ID="your_chat_id_here"telewrapperz --token "your_token" --chat_id "your_chat_id" "your_command"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 buttonINI format (legacy):
[Telegram]
token = your_bot_token_here
chat_id = your_chat_id_here
[Settings]
update_interval = 5.0
enable_log = trueYou can also enable persistent log files with an environment variable:
export TELEWRAPPERZ_ENABLE_LOG=true# 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 --testThe 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.pyRun 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.
You can create temperature alerts by wrapping a monitoring command/script with Telewrapperz.
When the command prints an alert message (or exits with code 1), you will see it immediately in Telegram and the status will become โ Error.
Example (Linux, NVIDIA GPU alert at 80ยฐC):
telewrapperz --log 'bash -lc '"'"'
while true; do
T=$(nvidia-smi --query-gpu=temperature.gpu --format=csv,noheader,nounits | head -n1)
echo "GPU Temp: ${T}ยฐC"
if [ "$T" -ge 80 ]; then
echo "๐ฅ ALERT: GPU temperature threshold exceeded (${T}ยฐC >= 80ยฐC)"
exit 1
fi
sleep 15
done
'"'"''Tip: if you already have a custom monitoring script, run that script through Telewrapperz to receive the same alerts remotely.
๐ฅ 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]
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Telewrapperz โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ โ
โ โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ โ
โ โ Command โโโโโโถโ Log Buffer โ โ
โ โ Process โ โ (Last 50 lines)โ โ
โ โโโโโโโโโโโโโโโ โโโโโโโโโโฌโโโโโโโโโ โ
โ โ โ
โ โโโโโโโโโโโโโโโ โ โ
โ โ System โ โ โ
โ โ Monitor โโโโโโโโโโโโโโโโค โ
โ โ (CPU/RAM/GPU) โ โ
โ โโโโโโโโโโโโโโโ โ โ
โ โผ โ
โ โโโโโโโโโโโโโโโโโโโ โ
โ โ Telegram โ โ
โ โ Dashboard โ โ
โ โ (Auto-update) โ โ
โ โโโโโโโโโโโโโโโโโโโ โ
โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
| 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 |
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.
- Open Telegram and search for @BotFather
- Send
/newbotand follow the instructions - Copy the token provided
- 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
- ๐ 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 | Terminal Emulation | Notes |
|---|---|---|
| Linux | PTY (full) | Best support, native terminal emulation |
| macOS | PTY (full) | Native terminal emulation |
| Windows | PIPE | Subprocess with line-buffered output |
This project is licensed under the MIT License - see the LICENSE file for details.
Made with โค๏ธ for remote monitoring