我有这个与主管一起运行的 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
进程也会继续运行。inotifywait
一旦 bash 脚本退出,有没有办法杀死它?
此程序的编辑 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