I have this so far. The issue is, if pythoncode.py
started before 8*60*60
seconds, then it can still continue running beyond 8*60*60
seconds until it finishes and only then will it stop. I need it to terminate pythoncode.py
at exactly (loosely, +- 1 second is not an issue) 8*60*60
seconds even if it is running.
#! /bin/bash
end=$((SECONDS+8*60*60))
while [ $SECONDS -lt $end ]; do
python3 /Users/Name/Desktop/pythoncode.py
done
I'm a beginner so explaining what to do specifically with this example would be appreciated over just a general answer. Thanks and happy new year.