【发布时间】:2018-05-23 21:18:47
【问题描述】:
我让这个 bash 脚本与主管一起运行
#!/bin/bash
DIR="/home/files"
while read file; do
IFS=', ' read -r -a array <<< "$file"
echo "Time: ${array[0]}"
echo "File: ${array[1]}"
#... doing something with the file
done < <(inotifywait -m -r -e close_write "$DIR" --timefmt "%d_%b_%Y" --format "%T %w%f")
它运行得很好,但是当我执行supervisorctl stop all 时,即使程序停止,inotifywait 进程也会继续运行。一旦 bash 脚本退出,有没有办法杀死 inotifywait?
编辑 1 该程序的主管配置是
[program:watch]
command=/root/watch_data.sh
user=root
stderr_logfile=/var/log/supervisord/watch_cloud.log
stdout_logfile=/var/log/supervisord/watch_cloud.log
autorestart=true
stopsignal=INT
【问题讨论】:
标签: bash ubuntu supervisord inotifywait