ps_functions.sh #4

  • //
  • guest/
  • perforce_software/
  • sdp/
  • main/
  • Server/
  • Unix/
  • p4/
  • common/
  • bin/
  • ps_functions.sh
  • View
  • Commits
  • Open Download .zip Download (815 B)
#!/bin/bash
#==============================================================================
# Copyright and license info is available in the LICENSE file included with
# the Server Deployment Package (SDP), and also available online:
# https://swarm.workshop.perforce.com/projects/perforce-software-sdp/view/main/LICENSE
#------------------------------------------------------------------------------

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

# get_pids ($exe)
# Usage: Call with an exe name, e.g. /p4/1/bin/p4web_1
#
# Example:
# p4web_pids=$(get_pids $P4WEBBIN)
# p4broker_pids=$(get_pids $P4BROKERBIN)

# This implementation works on Mac OSX and a variety of Unix/Linux systems.
get_pids () {
   exe=$1
   pids=$($PS -ef|$GREP "${exe}"| $GREP -v " $GREP " | $AWK '{print $2}')
   echo $pids
}
# Change User Description Committed
#5 18961 C. Thomas Tyler Released: SDP/MultiArch/2016.1/18958 (2016/04/08).
#4 15856 C. Thomas Tyler Replaced the big license comment block with a shortened
form referencing the LICENSE file included with the SDP
package, and also by the URL for the license file in
The Workshop.
#3 12171 Russell C. Jackson (Rusty) Merge in changes to remove the need for p4master_run.
#2 11568 Russell C. Jackson (Rusty) Removed extra space that breaking the grep.
#1 10148 C. Thomas Tyler Promoted the Perforce Server Deployment Package to The Workshop.