(2)If immediate action is necessary, he shall, before giving such notice or before the period of notice expires, himself take such temporary measures as he thinks fit to prevent danger, and the cost of doing so shall be recoverable from the owner in the manner hereinafter provided.