linux - why inotifywait command shows multiple pids? -
i created 1 bash script named "quicktest.sh". task of script set inotifywait on data folder users home directory.
code of quicktest.sh down below:
function inotify_data() { user="$1" if [ -d /home/$user/data ]; while read -r path action file; echo "the file '$file' created" chmod 0777 -r /home/$user/data done < <(exec inotifywait -m -r /home/$user/data -e moved_to -e create -e modify) fi } cd /home/ ls >/tmp/.grp i=1 n=`wc -l </tmp/.grp` while [ "$i" -le "$n" ] user=`awk "nr==$i" /tmp/.grp` echo "setting watch on $user data folder." inotify_data "$user" & i=$((i+1)) done
i have 2 users in machine, after running script, run "ps -ef | grep -i quicktest.sh" , shows 2 process of file.
Comments
Post a Comment