Metadata-Version: 2.4
Name: runce
Version: 0.1.7
Summary: Ensure only one instance of your process runs at a time.
Author: Biojet1
License: MIT
Project-URL: Homepage, https://github.com/biojet1/runce
Project-URL: Documentation, https://github.com/biojet1/runce#readme
Project-URL: Repository, https://github.com/biojet1/runce
Classifier: Operating System :: POSIX :: Linux
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: license-file

# Runce

# 🚀 The One-and-Done Process Wrangler

> _"Runce and done! No repeats, no retreats!"_ 🏃‍♂️💨  
> 🔒 **Guaranteed Singleton Execution** • 📊 **Process Tracking** • ⏱️ **Lifecycle Management**

[![PyPI version fury.io](https://badge.fury.io/py/runce.svg)](https://pypi.python.org/pypi/runce/)

## ☕ Support

If you find this project helpful, consider supporting me:

[!["Buy Me A Coffee"](https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png)](https://www.buymeacoffee.com/JetLogic)

## Features ✨

- 🚫 **No Duplicates**: Each command runs exactly once per unique ID
- 📝 **Process Tracking**: View all managed processes with status
- ⏱️ **Execution Time**: Track how long processes have been running
- 📂 **Log Management**: Automatic stdout/stderr capture
- 🛑 **Clean Termination**: Proper process killing

## Installation 📦

```bash
pip install runce
```

## Usage 🛠️

```bash
# Run a singleton process
runce run --id my-process -- python script.py

# List all processes
runce list

# View output
runce tail my-process -n 20

# Stop a process
runce kill my-process

# Restart a process
runce restart my-process

# Clean dead processes
runce clean
```

## Examples 💡

### 1. Running a Background Service

```bash
runce run --id api-server -- python api.py
```

### 2. Checking Running Processes

```bash
$ runce list
PID     NAME        STATUS      ELAPSED    COMMAND
1234    api-server  ✅ Running  01:23:45   python api.py
5678    worker      ❌ Stopped  00:45:30   python worker.py
```

### 3. Preventing Duplicates

```bash
$ runce run --id daily-job -- python daily.py
🚀 Started: PID:5678(✅ Running) daily-job

$ runce run --id daily-job -- python daily.py
🚨 Already running: PID:5678(✅ Running) daily-job
```

## How It Works ⚙️

1. **Process Locking**: Each `--id` creates a lock file
2. **PID Tracking**: Running processes are tracked in JSON files
3. **Singleton Enforcement**: Duplicate execution prevented
4. **Cleanup**: Dead processes can be automatically cleaned

## Development 🏗️

```bash
# Install in development mode
pip install -e .

# Run tests
pytest

# Lint code
flake8 runce
```

[![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0)
