Skip to content

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.

License

Notifications You must be signed in to change notification settings

ryanstout/live_die_repeat

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Live Die Repeat

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.

Description

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.

Installation

To build the project, you'll need Rust installed on your system. Then:

cargo install --path .

Usage

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...

Features

  • Wraps any shell command
  • Gracefully handles process termination
  • Restarts processes on SIGUSR1 signal
  • Preserves exit codes from child processes
  • Simple and lightweight

Dependencies

The project uses the following crates:

  • ctrlc: Signal handling for Ctrl+C
  • signal-hook: Unix signal handling

Example

# Start a web server
live_die_repeat "python -m http.server 8000"

# In another terminal, restart the server:
pkill -USR1 live_die_repeat

License

This project is open source and available under the MIT License.

About

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.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages