I'm writing a stop routine for a start-up service script:

do_stop()
{
  rm -f $PIDFILE
  pkill -f $DAEMON || return 1
  return 0
}

The problem is that pkill (same with killall) also matches the process representing the script itself and it basically terminates itself. How to fix that?

Edit
Report