Use arrays and nested for-loops to search for program files
Previously there was a brute force approach and a lot of
duplication.

With this change the script will break out of the
inner loop once both files have been located instead of carrying
on checking remaining locations. The value of the $PROGPATH array
is queried to check for missing files instead of using test -f to
see whether a file exists or not.

To make the search as fast as possible, both program files should
be put in the same $BINDIR (eg /usr/sbin) and have that directory
moved to the front of the list in the for loop.
Revert "Simplify getpids function by using sed"

This reverts commit f1722ac29c486f599ac19b78c46f3a7cb009e5aa.

Doesn't seem to work.
Remove unnecessary getpids check when stopping the service