27. Useful Scripts
By: Steve Krenzel
Previous Index Next
Autoreload process on directory change

I've been doing a lot of programming using Tornado recently, but my one complaint is that its autoreloading is really broken. When I change a file, I want the server to restart without me needing to do anything.

I've also ran across this problem in several other situations and simply wanted a generic script to watch a directory and reload a process if anything changed. To fix this, I wrote an autoreload script that does exactly what I need.

Just run the script from the current working directory that you want to track. The argument to the script is the process you want to run. In my case, I just run:

./autoreload python main.py
About the author
I'm Steve Krenzel, a software engineer and co-founder of Thinkfuse. Contact me at steve@thinkfuse.com.
Previous Next