Skip to main content

Runce

🚀 The One-and-Done Process Wrangler

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

runce PyPI version fury.io

☕ Support

If you find this project helpful, consider supporting me:

ko-fi

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 📦

pip install runce

Usage

runce <command> [options] [arguments]

Commands

run

Runs a new singleton process.

runce run [options] ARG...

Options:

  • --id <run_id>: Unique run identifier (required).
  • --cwd <cwd>: Working directory for the command.
  • -t <tail> / --tail <tail>: Tail the output (n lines). Use -t -1 to print the entire output.
  • --overwrite: Overwrite existing entry if it exists.
  • --run-after <command>: Run a command after the main command finishes.
  • --split : Dont merge stdout and stderr

Example:

runce run --id my-unique-task sleep 60

ls / list

Lists all managed processes.

runce ls [options]

Options:

  • -f <format> / --format <format>: Format of the output line (see examples below).

Example:

runce ls
runce ls -f "{pid}\t{name}\t{command}"

status

Checks the status of processes.

runce status [options] [ID...]

Options:

  • -f <format> / --format <format>: Format of the output line.

Example:

runce status my-unique-task

kill

Kills running processes.

runce kill [options] ID...

Options:

  • --dry-run: Perform a dry run (don't actually kill).
  • --remove: Remove the entry after killing.

Example:

runce kill my-unique-task

clean

Cleans up entries for non-existing processes.

runce clean [ID...]

Example:

runce clean

tail

Tails the output of processes.

runce tail [options] [ID...]

Options:

  • -n <lines> / --lines <lines>: Number of lines to tail.
  • --header <format>: Header format.
  • -x / --only-existing: Only show existing processes.
  • -t / --tab: Prefix tab space to each line.

Example:

runce tail my-unique-task
runce tail -n 20 my-unique-task

restart

Restarts a process.

runce restart [options] ID...

Options:

  • -t <tail> / --tail <tail>: Tail the output after restarting.

Example:

runce restart my-unique-task

Examples 💡

1. Running a Background Service

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

2. Checking Live Processes

$ runce list
PID     NAME        STATUS      ELAPSED    COMMAND
1234    api-server   Live  01:23:45   python api.py
5678    worker       Gone  00:45:30   python worker.py

3. Preventing Duplicates

$ runce run --id daily-job -- python daily.py
🚀 Started: PID:5678( Live) daily-job

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

Formats

The -f / --format option in the ls and status commands allows you to customize the output format. You can use the following placeholders:

  • {pid}: Process ID
  • {name}: Run ID / Name
  • {pid_status}: Process status ("✅ Live" or "👻 Gone")
  • {elapsed}: Elapsed time
  • {command}: The command being executed

How It Works

RunCE stores process information in JSON files within a temporary directory (/tmp/runce.v1 on Linux). Before starting a new process, it checks for existing entries with the same ID to prevent duplicates.

Development 🏗️

# Install in development mode
pip install -e .

# Run tests
pytest

# Lint code
flake8 runce

License: GPL v3

Release files for runce 0.4.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for runce 0.4.3
File Size Uploaded
runce-0.4.3.tar.gz 32.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for runce 0.4.3
File Interpreter ABI Platform
runce-0.4.3-py3-none-any.whl Python 3 none any Details

Total release size: 59.3 kB

Release files / runce-0.4.3.tar.gz

Download URL runce-0.4.3.tar.gz
Size 32.8 kB
Tags Source
SHA-256 checksum
How to use checksums
99d084366a65a28accc5037e74030e3ba270a07e7eb23b55ea5dcc54d62b387e
BLAKE2b-256 checksum
How to use checksums
ef455383ad4867df4737e2747ac67ccca88669571e8c7e8877d9d467f25cf37e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.10.18

Release files / runce-0.4.3-py3-none-any.whl

Download URL runce-0.4.3-py3-none-any.whl
Size 26.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
65fcf839bb3434e5e992e72d92eda7423ebf3c584ffdd4cbde386e920a0ad20b
BLAKE2b-256 checksum
How to use checksums
dd5ab8a089612cf7d38a4b4f5c34ad79d2a98e38834021fca14ab661e774551b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.10.18

Release history Release notifications | RSS feed

This release

0.4.3 This release

2 release files

0.4.2

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.9

2 release files

0.1.8

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page