Hi,
I would like to have a script with an infinite loop, that kills all processes created by this script when it gets executed again.
So basically you start the script via terminal:
bash poll.sh
and it's running infinitely, you open another terminal and again
bash poll.sh
and all poll.sh processes will get killed.
What would be the best way to do that? My first thought was to set environment variables, something like export POLLRUNNING=true and poll.sh would implement something like if [ $POLLRUNNING = true ]; exit 1
My second idea was to work with touch .isrunning and statement to ask for that file.
How would you do that?