I am trying to write a nanny script, to use in AWS's Linux terminal, to run a python script that can be a bit flakey at times. I am very new to using the terminal / bash, etc, so I could be missing something totally obvious / second nature to others. Here is what I have:
#! /usr/bin/env bash
while true:
script.py
sleep 1 # pause, so if script.py immediately dies we don't burn a core
I put the above code in a runProgram.sh file, located in the same directory as my python program. I then went into the terminal, and ran:
chmod -x runProgram.sh
followed by:
bash runProgram.sh
The terminal throws the following error:
"line 6: syntax error: unexpected end of file".
I took the bash code right from a stackoverflow response though, so I'm not sure what I'm missing in terms of syntax etc. any help is appreciated!