I start a python script and then after some time i want to kill it. but before killing it I want to start another copy of this same script and then kill the previous one after starting new one. I want to do this in loop.
here is my code , i just need a clean way to kill scripts.I do not want to use timeouts.
#!/bin/bash
while true
do
echo "starting FIRST Consumer.py : $(date +"%T")"
python3 /home/irum/Desktop/Marketsyc/Consumer.py &
sleep 20
echo "starting SECOND Consumer.py : $(date +"%T")"
python3 /home/irum/Desktop/Marketsyc/Consumer.py &
# Here I want to kill FIRST Consumer.py
sleep 20
# Here I want to kill SECOND Consumer.py
done