Section 10. If a person has been convicted of a crime punishable, at the discretion of the court, by fine or imprisonment in the jail or house of correction or by fine or imprisonment in the state prison, the court may impose upon him a conditional sentence, and order him to pay a fine within a limited time which shall be expressed in the sentence, and in default thereof to suffer such imprisonment as is provided by law. He shall be forthwith committed to the custody of an officer in court or to the jail, to be detained until the sentence is complied with; and if he does not within the time limited pay the fine imposed, the sheriff shall cause the other part of the sentence to be executed forthwith.