backported some improvements from the jsc script, adding locks and logs, etc
added a script to kill stuck locks, for administrative purposes