【发布时间】:2012-01-14 22:08:18
【问题描述】:
我正在尝试在 bash 中编写一个包装脚本来自动启动和关闭我需要同时运行的三个程序:
#!/bin/bash
gnome-screensaver-command -i -n aeolus-wrapper.sh &
aeolus &
qjackctl
启动它们后,我需要监控 aeolus 和 qjackctl 并在 aeolus 或 qjackctl 退出时终止剩余的两个进程:
# if aeolus exits, kill gnome-screensaver-command and qjackctl
# if qjackctl exits, kill gnome-screensaver-command and aeolus
这就是我卡住的地方。我对this example 很感兴趣,它展示了如何使用until 循环来监视进程并在它死亡时重新启动它,但我不太确定如何从那里到达我想去的地方。非常欢迎任何建议。
【问题讨论】: