improve restart script; handle http request timeout and error;