You could also read the server.ini file and loop through each process in the environments. You can use the following tcl code to parse it quickly.
# Create the path to the server.ini file and read the contents.
set serverFilePath /hci/root3.8.1P/server/server.ini
if {[catch {set fileIn [read_file -nonewline $serverFilePath]} emsg]} {echo 0; return {}}
# Start parsing the file contents to find the environs= entry.
set linesIn [split $fileIn n]
set environsIndex [lsearch $linesIn *environs*]
set environsIn [split [lindex $linesIn $environsIndex] “;”]
regsub -all “environs=” $environsIn “” environsIn
You could also do as you suggested and ps -ef | grep for the lock manager. Depends on what else you may do in the script, as to whether or not you want to loop through all of your sites.