I'm not an expert when it comes to InDesign server but are you aware of the existing integration  between AEM and InDesign server?
Sounds like this could be a more sophisticated integration approach compared to shell scripts.
If you really need to call a command line script from within AEM, this is usually handled best through a workflow step.
You may want to look at the out-of-the-box DAM Update Asset that comes with similar steps, e. g. to call ImageMagick on the command line in the "EPS thumbnails" step.
Please keep in mind that this requires solid error handling on both ends: the workflow step and the shell script. If you are working with shell scripts from within AEM, you want that to be properly tested and "bullet proof".