adding a lockfile

without this the script doesn't stop the server when reboot or shutdown the machine