Sample Header Ad - 728x90

Run foreground process until background process exited in shell

0 votes
2 answers
653 views
I'm running QEMU virtual machine in -daemonize mode and then spawn an arbitrary foreground (possibly interactive) process intended to interact with the QEMU instance. In general once foreground process completes I do a cleanup of QEMU instance via pidfile: qemu-system ... -pidfile ./qemu.pid -daemonize /my/custom/interactive/process pkill -F ./qemu.pid However in some scenarios QEMU could exit independently and my foreground process continues to run. But I would like to stop it in case. So the behavior of my custom interactive process should be like: tail -f --pid=./qemu.pid /dev/null How can I do that nicely? Maybe there is some kind of timeout-like wrapper, so I could run something like: trackpid ./qemu.pid /my/custom/interactive/process
Asked by reddot (296 rep)
Sep 7, 2021, 01:31 PM
Last activity: Sep 8, 2021, 10:33 AM