2

I'm looking at some init.d scripts, and a number of them use this what is essentially this command in their "stop)" target:

kill $(pidof ${DAEMON_NAME})

The pidof ${DAEMON_NAME} is actually a script function that checks the status code and calls exit if necessary, nonetheless, How is the above any different than this:

killall ${DAEMON_NAME}

A lot of init.d script simplification would be had if they are.

EDIT: I should add these "processes" aren't daemons and don't actually record their PID in the FS anywhere ...

Jamie
  • 1,364

1 Answers1

0

Yes, they are functional identic.

pidof is a shell function.

Note that killall came after kill and was not available in all Linux/Unix variants.

So the kill/pidof was the more generic appoach if you had to write init-scrips.

Nils
  • 7,815