so-elasticsearch-ilm-start is missing the shebang at the beginning of the file and so it is spawning a whole new bash shell. Also add an echo the end of so-elasticsearch-ilm-start and so-elasticsearch-ilm-stop.