There's already a tool to do exactly that: checkpath (see man 8 runscript), for example "checkpath -d -m 0770 -o : /var/run/heartbeat, but apart from that, your fix seems correct. Regards, Luis