ps.lib #1

  • //
  • guest/
  • perforce_software/
  • sdp/
  • main/
  • Server/
  • Unix/
  • p4/
  • common/
  • lib/
  • ps.lib
  • View
  • Commits
  • Open Download .zip Download (926 B)
# shellcheck shell=bash
           
#==============================================================================
# Copyright and license info is available in the LICENSE file included with
# the Server Deployment Package (SDP), and also available online:
# https://workshop.perforce.com/view/p4-sdp/dev/LICENSE
#------------------------------------------------------------------------------

# Common functions for using 'ps' to check on process ids.

#------------------------------------------------------------------------------
# Function: get_pids ($exe)
# Usage: Call with an exe name, e.g. /p4/1/bin/p4broker_1
#
# Example:
# p4broker_pids=$(get_pids $P4BROKERBIN)
#
# This implementation works on a variety of UNIX/Linux systems and Mac OSX.
function get_pids () {
   local exe=${1:-}
	local pids=

   pids=$($PS -ef|$GREP "${exe}"| $GREP -v " $GREP " | $GREP -v "${exe}_init " | $AWK '{print $2}')
   echo $pids
}
# Change User Description Committed
#1 32135 C. Thomas Tyler Released SDP 2025.1.32133 (2025/10/29).
Copy Up using 'p4 copy -r -b perforce_software-sdp-dev'.
//guest/perforce_software/sdp/dev/Server/Unix/p4/common/lib/ps.lib
#1 32044 C. Thomas Tyler Slow Refactoring: "Moving" log_functions.sh from bin to lib directory,
and changing to .lib extension per coming SDP Coding Standard for bash.

The "slow refactoring" means for this change, the original log_functions.sh
will remain in the bin directory, and a new logging.lib file will be added
in the lib directory.  The removal of the file in bin will occur separately.
This is intended to balance allowing progress while preventing potential
disruption to customers who may have supplemental automation relying on the
current names.

New libs: ps.lib, logging.lib, run.lib

We may also allow legacy exceptions since customer-side custom scripts may
have dependencies on backup_functions.sh and other *.sh libraries in the bin
directory.

Unrelated minor fixes in p4verify.sh.