If the jail be insufficient or if there be danger of escape, lynching or rescue of any prisoner therein, or danger of an attack upon the jail by any person or persons, or if there be no jail, or if the sheriff or jailer shall have any person or persons lawfully in his custody and there be danger of the seizure, lynching, escape or rescue of any such person or persons, or if mob violence has been threatened against any such person or persons, it shall be the duty of the sheriff or jailer to summon a sufficient guard to protect and secure such prisoner, or to protect the jail, so long as the same may be necessary and no longer. The sheriff or jailer shall furnish to the circuit court of his county a certified list of all persons thus summoned, who served as such guard, together with the length of time each thus served, and he shall furnish to the court and also to the grand jury a list of all persons thus summoned who failed, neglected or refused to heed the summons of the sheriff or jailer. The circuit court upon due proof may allow to each person not more than Five Dollars ($5.00) for each day and night he may have been employed as guard, or at this rate for a greater time, to be paid out of the county treasury upon the order of the court and the issuance of a warrant therefor by the board of supervisors. This section shall not authorize the employment of permanent guards for the jail or for prisoners away from the jail, but only in an emergency. All persons summoned by the sheriff or jailer under the provisions of this section who shall fail, neglect or refuse to obey said summons shall, upon conviction, be punished as for a misdemeanor, and it shall be the duty of the circuit judge to charge the grand jury especially in this regard.