Ignore SIGHUP — survive terminal closure in background
__main__.py: add signal.SIGHUP → SIG_IGN before setting up SIGINT/SIGTERM handlers. Sniffer no longer dies when the terminal closes or the shell session ends. README: add Background / Daemon section with nohup examples.
This commit is contained in:
1 parent
ad8d661caa
commit
fb5c1fbf6a
2 files changed
+12
No files matched your search
@@ -129,6 +129,17 @@ Non-TPDU messages (ATR, PPS, card state changes, Fi/Di) print identically in all
|
||||
- **GSMTAP**: ATR (subtype 1) and TPDU (subtype 2) over UDP to Wireshark
|
||||
- **PCAP**: all messages as GSMTAP-encapsulated packets (LINKTYPE 155), openable in Wireshark
|
||||
|
||||
## Background / Daemon
|
||||
|
||||
SIGHUP is ignored by default — terminal closure won't kill the sniffer.
|
||||
To run persistently in the background with output to files:
|
||||
|
||||
```sh
|
||||
nohup ./sniff-start.sh --output /tmp/sniff.log &> /tmp/sniff-err.log &
|
||||
# or
|
||||
FORMAT=timestamp nohup python -m simtrace2_pysniff --output /tmp/sniff.log &> /tmp/sniff-err.log &
|
||||
```
|
||||
|
||||
## Library Usage
|
||||
|
||||
```python
|
||||
|
||||
@@ -131,6 +131,7 @@ def main():
|
||||
file_dumper.close()
|
||||
sys.exit(0)
|
||||
|
||||
signal.signal(signal.SIGHUP, signal.SIG_IGN)
|
||||
signal.signal(signal.SIGINT, on_signal)
|
||||
signal.signal(signal.SIGTERM, on_signal)
|
||||
|
||||
|
||||
Reference in new issue
Block a user