Use propper locking in start script

Also don't try to write to /var/lock, which is not writeable on some distributions.
Merge pull request #1 from BtbN/master

Use propper locking in start script