The first thing I stumbled upon was getting the python access log.
python -m SimpleHTTPServer > httpd.log
Or
python -m SimpleHTTPServer 2>&1 > httpd.log
That doesn't work,
python -m SimpleHTTPServer 2>&1 |tee httpd.log
It seems that it can be taken.
Since I used a pipe, I couldn't get the PID of python with $ !. Therefore http://qiita.com/mattintosh4/items/35e184d890c4453a8da7 I got the PID from jobs while referring to.
PYTHON_PID=`jobs -l|grep +|awk '{print $2}'`
Finally, I want to judge the end from the character string included in the log, so I decided to make sure that the log did not contain a particular string.
while [ "`cat httpd.log|grep filename.html`" = ""]; do
sleep 1
done
All sources
python -m SimpleHTTPServer 2>&1 |tee httpd.log
PYTHON_PID=`jobs -l|grep +|awk '{print $2}'`
while [ "`cat httpd.log|grep filename.html`" = ""]; do
sleep 1
done
kill $PYTHON_PID