Friday, December 05, 2014

Using Files for Inter-process Communication



I was abusing a test suite I had written to add test data to the database and I was running it inside an infinite loop because it was going to take a while to generate the 10,000 records I wanted. When it came time to stop, I had difficulty either control-c-ing or killing the right processes to get it to quit, so the second time I ran it, I did this instead:

while true
do
    if [ -f $HOME/stop_while ]; then
        break
    fi
    ./thing_i_wanted_repeated
done

Using files for inter-process communication seems so much more straightforward to me.

No comments: