(2)The Chief Municipal Officer may, if it appears to him necessary so to do, cause a proper hoarding or fence or other means of protection to be put up at the expense of the owner of such wall or building for the safety of the public or the inmates thereof; and may, after giving them such notice as the Chief Municipal Officer may think necessary, require the inmates of the building to vacate it.