Better lockfile logic
From #876 (closed)
Also, your implementation of the lock file could be better. The file BIND created was just an empty file. If BIND dies and leaves that lock file in place it will prevent BIND from being restarted. If you write BIND's PID into the file, then if the file exists you can send a signal 0 to that PID to verify that a process with that number is running. If the kill fails you can allow BIND to start even if the lock file exists. This works unless another process with the same PID just happens to have been started in the meantime; that's unlikely, but this is still better than not testing at all.