Indent command in comments for legibility
Test for command existence
Use printf rather than echo
Move dir creation to beneath option parsing
Check return value of lockdir creation