Do not wait a fixed period after trying to kill Deadwood processes
Use a while loop and short sleeps of 0.2s to check for death of
processes and exit the loop if dead. This should speed up stops
and restarts while still allowing 5s for processes to die.

After 5s a KILL signal is given and then up to a further 5s for
the process to die.

Note: COUNT="$(expr $COUNT + 1)" ought to be more portable than
certain alternatives.