If for some reason the startup process is interupted, such that ./osrm-extract $DATA_PATH/$2.osm.pbf completes but ./osrm-contract $DATA_PATH/$2.osrm does not, you will never actually be able to initialize the data correctly.
It would be more robust if you did something like
if [ ! -f $DATA_PATH/$2.initialized ]; then
if [ ! -f $DATA_PATH/$2.osm.pbf ]; then
curl $3 > $DATA_PATH/$2.osm.pbf
fi
if [ ! -f $DATA_PATH/$2.osrm ]; then
./osrm-extract $DATA_PATH/$2.osm.pbf
fi
./osrm-contract $DATA_PATH/$2.osrm
touch $DATA_PATH/$2.initialized
fi
If for some reason the startup process is interupted, such that
./osrm-extract $DATA_PATH/$2.osm.pbfcompletes but./osrm-contract $DATA_PATH/$2.osrmdoes not, you will never actually be able to initialize the data correctly.It would be more robust if you did something like