A simple command that runs another command and restarts it when it gets a SIGUSR1. Good for automatically restarting servers without hot reloading when you deploy.
Live Die Repeat is a command-line utility that wraps around any shell command and provides the ability to restart it by sending a SIGUSR1 signal. This is particularly useful during development when you need to restart processes frequently.
To build the project, you'll need Rust installed on your system. Then:
cargo install --path .
Run any command through live_die_repeat:
live_die_repeat "your_command_here"
To restart the running command, send a SIGUSR1 signal to the process:
kill -SIGUSR1 <PID>
Or use pkill
pkill -USR1 live_die_repeat
The PID will be displayed when you start the program:
🎯 Process started with PID: 1234
👂 Signal handler thread started, waiting for SIGUSR1...
- Wraps any shell command
- Gracefully handles process termination
- Restarts processes on SIGUSR1 signal
- Preserves exit codes from child processes
- Simple and lightweight
The project uses the following crates:
ctrlc
: Signal handling for Ctrl+Csignal-hook
: Unix signal handling
# Start a web server
live_die_repeat "python -m http.server 8000"
# In another terminal, restart the server:
pkill -USR1 live_die_repeat
This project is open source and available under the MIT License.