If there are several liens under sections 21 and 22 of this Act upon the same premises, and the owner or any person having such a lien shall fear that there is not a sufficient amount coming to the contractor to pay all such liens, the owner or any one or more persons having such lien may file his, her or their complaint in the circuit court of the proper county, stating such fact and such other facts as may be sufficient to a full understanding of the rights of the parties. The contractor and all persons having liens upon or who are interested in the premises, so far as the same are known to or can be ascertained by the plaintiff, upon diligent inquiry shall be made parties. Upon the hearing the court shall find the amount due from the owner to the contractor, and the amount due to each of the persons having liens, and in case the amount found to be due to the contractor shall be insufficient to discharge all the liens in full, the amount so found in favor of the contractor shall be divided between the persons entitled to such liens pro rata after the payment of all claims for wages in proportion to the amounts so found to be due them respectively. If the amount so found to be due to the contractor shall be sufficient to pay the liens in full, the same shall be so ordered. The premises may be sold as in other cases under this Act. The parties to such action shall prosecute the same under like requirements as are directed in section 11 of this Act, and all persons who shall be duly notified of such proceedings, and who shall fail to prove their claims, whether the same be in judgment against the owner or not, shall forever lose the benefit of and be precluded from their liens and all claims against the owner. Upon the filing of such complaint the court may, on the motion of any person interested, and shall, upon final judgment stay further proceedings upon any action against the owner on account of such liens, and costs in such cases shall be adjusted as provided for in section 17 of this Act.
770 ILCS 60/30