The court may by injunction, on good cause shown, restrain the party in possession from doing any act to the injury of real property during the existence of a lien or foreclosure of a mortgage thereon, and until the expiration of the time allowed for redemption.
SDCL 21-47-7