Made script compatible with BSD tools

* use either gnu mktemp or bsd mktemp with valid parameters:
  on BSD mktemp a prefix or template is mandatory
* use either gnu date or bsd date with valid parameters
  BSD date does not have the --date option but uses -v instead