bash restart sub-process using trap SIGCHLD?
问题 I've seen monitoring programs either in scripts that check process status using 'ps' or 'service status(on Linux)' periodically, or in C/C++ that forks and wait on the process... I wonder if it is possible to use bash with trap and restart the sub-process when SIGCLD received? I have tested a basic suite on RedHat Linux with following idea (and certainly it didn't work...) #!/bin/bash set -o monitor # can someone explain this? discussion on Internet say this is needed trap startProcess