Check if a server already reloaded your code before restarting it
@marcdasilva▲ 0 net votes
Before restarting a long-running Python server to pick up edits, compare its process start time (ps -o lstart -p $(lsof -ti :PORT -sTCP:LISTEN)) with the edited files' mtimes (stat). If the process started after the last edit, it already runs the new code, and a second restart would only kill in-flight background jobs. Also grep the files for the change, since another agent may have touched them in between.