-1

I run my scripts with timeout function

timeout 86400 ./start.sh

How can I terminate script before timeout counted down? Ctr+C does not work in this case Closing terminal still leaves process on background

This is my full script:

python3 startmeVtest.py 5 2 10
timeout 86400 ./start.sh
sleep 4
python3 startmeVtest.py 10 4 20
timeout 86400 ./start.sh
sleep 4
python3 startmeVtest.py 20 4 40
timeout 86400 ./start.sh
sleep 4
python3 startmeVtest.py 30 8 50
timeout 86400 ./start.sh
sleep 4
python3 startmeVtest.py 50 9 70
./start.sh
exit 0

I would like to exit from my bash script before it finish without using ps -A all the time.

7nebo7
  • 29
  • 4
  • 2
    Possible duplicate of [How to set the process name of a shell script?](https://stackoverflow.com/questions/3075682/how-to-set-the-process-name-of-a-shell-script) – Lajos Arpad Apr 24 '19 at 11:26

2 Answers2

0

find a list of processes by name using grep

pgrep timeout

kill all processes by name

pkill timeout 

宏杰李
  • 11,820
  • 2
  • 28
  • 35
0

The below will kill your start.sh script directly

pkill -f "start.sh"
nullPointer
  • 4,419
  • 1
  • 15
  • 27