I was using this
Code: Select all
killall -9 inotifywait
while inotifywait -e close_write /tmp/ap
do
bash -c passwordfn
done
Code: Select all
function aploop (){
while true
do
read line
if [[ "$line" ]]; then
bash -c passwordfn
unset line
sed -i '1d' /tmp/ap
bash -c aploop
exit
fi
sleep 1
done < /tmp/ap
}; export -f aploop
EDIT: this works too
Code: Select all
while true
do
watch -d -g ls -t -lR /tmp/ap && bash -c passwordfn
sleep 1
done
Code: Select all
tail -fn0 /tmp/ap | \
while read line ; do
echo "$line" | grep "+"
if [ $? = 0 ]
then
bash -c passwordfn
fi
done
Code: Select all
tail -fn0 /tmp/ap | \
while read line ; do
[[ "$line" ]] && bash -c passwordfn &
done