Script for Finding PeopleSoft Processes



I accidentally deleted a PeopleSoft Home without shutting down the app server.  So, I had to find all of the processes and manually kill each one of them.  A normal “ps -ef | grep FN91TST” didn’t cut it.  The app server spins off some JSL and WSL processes that don’t have the environment name anywhere in the command.

Here’s the script that ended up doing the job:


#!/bin/bash

PS_USER=psoft
TARGET_PS_HOME=/psoft/FN91TST

for e in `ls /proc/*/environ`; do
  PID=`echo $e | sed -e 's#/proc/##' -e 's#/environ##' `
  if [ -e $e ]; then
    if [ `stat -c %U $e` == $PS_USER ]; then
      CURR_PS_HOME=`cat $e | tr '\0' '\n' | grep "^PS_CFG_HOME" | sed 's/^PS_CFG_HOME=//'`
      if [ "$CURR_PS_HOME" == "$TARGET_PS_HOME" ]; then
        echo "PID: $PID Home: $CURR_PS_HOME"
        ps $PID
      fi
    fi
  fi
done

Note: This script assumes that you are using PeopleTools 8.52 with the PS_CFG_HOME variable configured. If not, you’ll need to change it to either the PS_HOME or PS_APP_HOME variable.


Share