Your original post didn't mention anything about trying to write a crash recovery script but your last reply implies it. Instead of telling us one of the steps that you are trying to accomplish and filling some of the details as you go, why don't you just explain the thing in full.