When the magistrate or a Judge of the Court in which the action is pending is satisfied, by proof on oath, that there is reason to believe that any such witness will not appear and testify unless security is required, he may order the witness to enter into a written undertaking, with sureties, in such sum as he may deem proper, for his appearance as specified in the preceding section.