If an action is brought against any officer or person for an act for the doing of which he had theretofore received any valid bond or convenant of indemnity, and he gives seasonable notice thereof in writing to the persons who executed such bond or covenant, and permits them to conduct the defense of such action, the judgment recovered therein is conclusive evidence against the persons so notified; and the court may, on motion of the defendant, upon notice of five days, and upon proof of such bond or covenant, and of such notice and permission, enter judgment against them for the amount so recovered and costs.