Question

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!

Was it helpful?

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.

OTHER TIPS

Bash traps many signals like SIGTERM(15) and SIGQUIT(3). You could send SIGHUP(1) or SIGKILL(9):

killall -s SIGHUP bash   ## or killall -s 1 bash
killall -s SIGKILL bash  ## or killall -s 9 bash
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top