Home arrow Journal arrow Killing all processes for a service from a FreeBSD Script
Killing all processes for a service from a FreeBSD Script PDF
Wednesday, 25 April 2012
Sometimes you want to kill all processes of a service and killall command is not working. For example your proftpd server is not working anymore and you want to restart it but the following commands will not work:

  /usr/local/etc/rc.d/proftpd stop

or:

  killall proftpd

In that case you could write a script that will kill every process that belongs to proftpd. Here is the script:

force_stop_proftpd.sh
#!/bin/sh

processes=`ps awux | grep proftpd | awk '{print $2}'`

for i in $processes
do
  echo "Stoping: "$i
  kill -9 $i
done

Last Updated ( Wednesday, 25 April 2012 )
 
< Prev   Next >

Other BSD Systems

OpenBSD

Misc

Solaris

Polls

Best BSD firewall?