Lightweight process monitor with Telegram alerts. Auto-restarts crashed processes, monitors CPU/memory/disk, sends alerts.
Project description
StillRunning
Lightweight process monitor with Telegram alerts. Watches your processes, restarts crashes, monitors system resources, and sends you alerts.
Features
- Process Watchdog: Auto-restarts crashed screen sessions
- Resource Monitoring: CPU, memory, disk usage alerts
- Per-Process Memory: Alerts when individual processes exceed thresholds
- Log Rotation: Auto-archives logs when they exceed size limits
- Health File Monitoring: Alerts when your app stops updating its heartbeat file
- Telegram Alerts: Get notified instantly when something breaks
- Telegram Commands: Text "status" to get a live summary
- Daily Heartbeat: Receive a daily health summary
- Restart Limits: Disables processes after 3 consecutive failures to prevent restart loops
Quick Start
pip install stillrunning
stillrunning --setup
The setup wizard will:
- Scan for running screen sessions and systemd services
- Detect log files in your working directory
- Ask for your app name and Telegram credentials
- Generate
stillrunning.yamlautomatically - Start monitoring
Manual Installation
pip install stillrunning
Create stillrunning.yaml:
app_name: "MyApp"
working_dir: "/home/user/myapp"
telegram_bot_token: "123456789:ABCdefGHI..."
telegram_chat_id: "987654321"
processes:
- name: "api"
screen: "api"
script: "api.py"
- name: "worker"
screen: "worker"
script: "worker.py"
log_files:
- path: "app.log"
max_mb: 10
keep_archives: 5
health_file: "status.json"
health_max_age_sec: 180
thresholds:
cpu_percent: 85
mem_percent: 85
disk_percent: 85
process_mem_mb: 500
Run:
screen -dmS stillrunning stillrunning
Telegram Setup
- Create a bot: Message @BotFather and send
/newbot - Copy the bot token
- Get your chat ID: Message @userinfobot and send
/start - Add both to your config
Telegram Commands
Text these to your bot:
status- Get live process and resource statushelp- Show available commandsenable all- Re-enable disabled processes
How It Works
StillRunning runs as a background process and:
- Checks if your screen sessions are alive every 30 seconds
- Restarts crashed processes automatically
- Monitors CPU/memory/disk every 60 seconds
- Sends Telegram alerts when thresholds are exceeded (with 1-hour cooldown to prevent spam)
- Archives log files when they exceed size limits
- Sends a daily heartbeat summary
Configuration Reference
| Field | Default | Description |
|---|---|---|
app_name |
"StillRunning" | Name shown in alerts |
working_dir |
current dir | Where your scripts live |
telegram_bot_token |
- | From @BotFather |
telegram_chat_id |
- | Your Telegram user ID |
processes |
[] | List of processes to monitor |
log_files |
[] | List of logs to auto-rotate |
health_file |
null | File to monitor for freshness |
health_max_age_sec |
180 | Alert if health file older than this |
thresholds.cpu_percent |
85 | CPU alert threshold |
thresholds.mem_percent |
85 | Memory alert threshold |
thresholds.disk_percent |
85 | Disk alert threshold |
thresholds.process_mem_mb |
500 | Per-process memory threshold |
intervals.process_check_sec |
30 | How often to check processes |
intervals.resource_check_sec |
60 | How often to check resources |
intervals.heartbeat_sec |
86400 | Daily heartbeat interval |
restart_cooldown_sec |
120 | Minimum time between restarts |
max_consecutive_failures |
3 | Disable process after this many failures |
Requirements
- Linux (uses
/proc/stat,/proc/meminfo,screen,pgrep) - Python 3.10+
- PyYAML
License
MIT
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 stillrunning-1.1.0.tar.gz.
File metadata
- Download URL: stillrunning-1.1.0.tar.gz
- Upload date:
- Size: 13.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
75ed2665af4ee0fb1798e3a730eb08a1f3c81c490768e13b274c174eb11fd08e
|
|
| MD5 |
620cfd406555db505d98703be8dfb471
|
|
| BLAKE2b-256 |
2f9fe6584871becc45595d5247993629c46e1a6849e96928d5b1d17f3cf91562
|
File details
Details for the file stillrunning-1.1.0-py3-none-any.whl.
File metadata
- Download URL: stillrunning-1.1.0-py3-none-any.whl
- Upload date:
- Size: 13.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0eb4e2e5542ff3a67d0847d091fb5c504ddfd07b108ab44cc2be76c0d9bb4690
|
|
| MD5 |
e3e27afc04533ff57e48cd72c0ae04c8
|
|
| BLAKE2b-256 |
0bc2776d2d6cef14d7e6b5d392470e9072bf3e2d1caa4159ca4ea34d27ce73cd
|