In case of using systemd, it would be a benefit to use tmpfiles to create lock-, pid- and perhaps log-files by the system. http://0pointer.de/public/systemd-man/tmpfiles.d.html