Does this gonna be infinitive loop? If so, it should be changed. I propose that we loop for 1 minute, not more, with sleep interval 5 seconds. If during 1 minute mongodb does not start we exit with error status and do nothing, i.e. do not start DAS.