Show HN: Linux CLI tool to provide mutex locks for long running bash ops

https://news.ycombinator.com/rss Hits: 4
Summary

WaitLock WaitLock is a portable UNIX/POSIX command-line tool that provides mutex and semaphore functionality for shell scripts. It enables synchronized access to resources across multiple processes with automatic cleanup when processes die. Features Mutex Mode : Single lock holder (default) : Single lock holder (default) Semaphore Mode : Multiple concurrent lock holders : Multiple concurrent lock holders Automatic Cleanup : Locks released when process dies : Locks released when process dies CPU-aware Locking : Can scale locks to CPU count : Can scale locks to CPU count Lock Inspection : List and check active locks : List and check active locks Multiple Output Formats : Human, CSV, and null-separated : Human, CSV, and null-separated Command Execution : Run commands while holding locks : Run commands while holding locks UNIX Integration : Environment variables, stdin, syslog : Environment variables, stdin, syslog Portable C Implementation: Runs on any POSIX system Quick Start # Install dependencies (Ubuntu/Debian) sudo apt-get install build-essential autoconf # Build and install ./configure make sudo make install # Basic usage - acquire exclusive lock waitlock myapp & # ... do exclusive work ... kill $! # Execute command with lock waitlock database_backup --exec " /usr/local/bin/backup.sh --daily " # List active locks waitlock --list Table of Contents Installation From Source Prerequisites C compiler (gcc, clang, or compatible) GNU Make autoconf (for building from git) Build Instructions # Clone the repository git clone https://github.com/user/waitlock.git cd waitlock # Generate configure script (if building from git) autoreconf -fi # Configure and build ./configure make # Run tests make check # Install system-wide sudo make install # Or install to custom prefix ./configure --prefix=/usr/local make install Build Options # Debug build ./configure CFLAGS= " -g -O0 -DDEBUG " # Release build with optimizations ./configure CFLAGS= " -O2 -DNDEBUG " # Cross-compilation examp...

First seen: 2025-07-17 06:14

Last seen: 2025-07-17 09:14