Add lockfile support to prevent race condition. See
https://support.isvtec.com/view.php?id=32351