Skip to main content

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.

Python Telegram Bot API License: MIT


โœจ 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.0
  • psutil
  • pynvml (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

  1. Open Telegram and search for @BotFather
  2. Send /newbot and follow the instructions
  3. Copy the token provided

2. Get Your Chat ID

  1. Start a chat with your new bot
  2. Send any message to the bot
  3. Visit: https://api.telegram.org/bot<YOUR_TOKEN>/getUpdates
  4. Look for "chat":{"id":XXXXXXXX} โ€” that's your Chat ID

๐Ÿ’ก Tips & Best Practices

  • ๐Ÿ Use python -u for 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 request if 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

telewrapperz-0.1.0.tar.gz (17.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

telewrapperz-0.1.0-py3-none-any.whl (14.5 kB view details)

Uploaded Python 3

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

Hashes for telewrapperz-0.1.0.tar.gz
Algorithm Hash digest
SHA256 a15eeebf8b7c5c8357d02efcc3a0da3c0b0627ed094bd345b3bb7c9ca27c3aa0
MD5 a6ee0233d59ab20dd338a586f0643bd1
BLAKE2b-256 6aa607af60ecb934eeeafee2071a99085c0dd347d34919fd22bc61e45d74d6e7

See more details on using hashes here.

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

Hashes for telewrapperz-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e4dae13516c1147c60a9d01b0fa92c1ae6df186a81b3734e1125381588042083
MD5 1a11dbc7b5ba0472bd3c727b6da44250
BLAKE2b-256 380ad891b0b5714e4befe4f0c2574c77fa1a572f1cbdb1022d59982cc555d77a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page