Search code examples
bashcronterminate

Using killall to terminate bash


I must terminate a Python script and 2 bash scripts using crontab.

I needed a command to terminate all bash scripts ('killall Python' already works for terminating the python script) but when i use 'killall bash' it doesn't works...

Does anyone knows a solution to my problem? Maybe another command, or an especific way to use killall!

Thanks in advance!


Solution

  • Try the following command :

    killall -s SIGHUP bash
    

    but you shouldn't do this, you can potentially kill all bash of all users. Instead, I recommend you to use

    pkill -f script_name.bash
    

    and

    pkill -1 -f script_name.bash
    

    if needed.