§ 38. When injunction may be obtained. In an action in the supreme court or county court for the recovery of a penalty or forfeiture incurred for the violation of any of the provisions of this chapter, or of any other law the enforcement of which is within the jurisdiction of the department, or of the rules of the department, an application may be made on the part of the people to the court or any justice thereof or to the county judge if the defendant be a resident of such county for an injunction to restrain the defendant, his agents and employees from the further violation of such provisions. The court or justice to whom such application is made, shall grant such injunction on proof, by affidavit, that the defendant has been guilty of the violations alleged in the complaint, or of a violation of any such provision subsequent to the commencement of the action. No security on the part of the plaintiff shall be required, and costs of the application may be granted or refused in the discretion of the court or justice. If the plaintiff shall recover judgment in the action for any penalty or forfeiture demanded in the complaint, the judgment shall contain a permanent injunction, restraining the defendant, his agents and employees from any further violation of such provision of this chapter or of any other law the enforcement of which is within the jurisdiction of the department or of the rules of the department. Any injunction, order or judgment obtained under this section may be served on the defendant by posting the same upon the outer door of the defendant's usual place of business, or where such violation was or is committed, or in the manner required by the civil practice act, and the rules and practice of the court. Personal service of the injunction shall not be necessary when such service cannot be secured with reasonable diligence, but the service herein provided shall be deemed sufficient in any proceeding for the violation of such injunction.