Use propper locking in start script

Also don't try to write to /var/lock, which is not writeable on some distributions.