Only code shell functions once.

All bareos-ctl-* scripts code the same set of functions which is kind
of stupid. This patch creates a common set of functions which are
included into the script so we only need to code them once and reuse
them. Also added support for pgrep support which is on Platforms like
Solaris and xBSD next to pidof support.