https://github.com/msantos/pdeathsigexec-rs
signal process when parent exits
https://github.com/msantos/pdeathsigexec-rs
exec prctl procctl signal
Last synced: 2 months ago
JSON representation
signal process when parent exits
- Host: GitHub
- URL: https://github.com/msantos/pdeathsigexec-rs
- Owner: msantos
- License: isc
- Created: 2023-08-18T10:30:16.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2025-03-03T12:14:38.000Z (3 months ago)
- Last Synced: 2025-03-03T13:25:41.749Z (3 months ago)
- Topics: exec, prctl, procctl, signal
- Language: Rust
- Size: 8.79 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# SYNOPSIS
pdeathsigexec *cmd* *...*
# DESCRIPTION
pdeathsigexec: signal process when parent exits
Subprocesses orphaned by a parent process's exit are typically reparented
to init (PID 1) and continue running. `pdeathsigexec` ensures a process
receives a signal upon its parent's termination.The "signal on parent termination" behaviour applies
to the executed process only and not descendents
([prctl(2)](https://man7.org/linux/man-pages/man2/prctl.2.html)):> The parent-death signal setting is cleared for the child of a fork(2).
> It is also (since Linux 2.4.36 / 2.6.23) cleared when executing a
> set-user-ID or set-group-ID binary, or a binary that has associated
> capabilities (see capabilities(7)); otherwise, this value is preserved
> across execve(2).# EXAMPLES
```
$ sh -c "sleep inf" &
[1] 25880
$ kill -9 25880
$ pgrep -fa sleep
25882 sleep inf
```## pdeathsigexec
```
$ sh -c "pdeathsigexec sleep inf" &
[1] 25926
$ kill -9 25926
$ pgrep -fa sleep```
# Build
```
cargo build
```# OPTIONS
## pdeathsigexec
-s/--signal
: set the termination signal (default `9` (SIGKILL))# ENVIRONMENT VARIABLES
None.