IBM Sterling Connect:Direct : Script to get process in HOLD and WAIT queue: Difference between revisions

From Wiki
(Created page with " = Script = #!/bin/bash set +vx NDMAPICFG=/home/cdadmin02/cdunix/ndm/cfg/cliapi/ndmapi.cfg export NDMAPICFG # executa o sel pro selpro_output=$(/home/cdadmin02/cdunix/ndm/bin/direct -s << EOJ selpro; EOJ ) count=$(echo "$selpro_output" | grep -c "HOLD" ) if [ $count -gt 0 ]; then echo "processos em HOLD - $count vezes:" > processo_HOLD.out else echo "" > processo_HOLD.out fi count=$(echo "$selpro_output" | grep -c "WAIT" ) if [ $count -g...")
 
No edit summary
 
Line 1: Line 1:
 
This script get the output from command "sel pro", and generate a file for process in HOLD, WAIT. The script can output the result from a list of process by name.


= Script =
= Script =
Line 8: Line 8:
  export NDMAPICFG
  export NDMAPICFG
   
   
  # executa o sel pro
  # Execute sel pro command
  selpro_output=$(/home/cdadmin02/cdunix/ndm/bin/direct -s << EOJ
  selpro_output=$(/home/cdadmin02/cdunix/ndm/bin/direct -s << EOJ
  selpro;
  selpro;
Line 14: Line 14:
  )
  )
   
   
# Output the number of process in HOLD
  count=$(echo "$selpro_output" | grep -c "HOLD" )
  count=$(echo "$selpro_output" | grep -c "HOLD" )
  if [ $count -gt 0 ]; then
  if [ $count -gt 0 ]; then
Line 21: Line 22:
  fi
  fi
   
   
# Output the number of process in WAIT
  count=$(echo "$selpro_output" | grep -c "WAIT" )
  count=$(echo "$selpro_output" | grep -c "WAIT" )
  if [ $count -gt 0 ]; then
  if [ $count -gt 0 ]; then
Line 29: Line 31:
   
   
   
   
  # Defina os PNAME
  # Define process PNAME
  strings=("COPY2SFG" "processo2" "processo3")
  strings=("COPY2SFG" "processo2" "processo3")
   
   

Latest revision as of 12:13, 2 October 2023

This script get the output from command "sel pro", and generate a file for process in HOLD, WAIT. The script can output the result from a list of process by name.

Script

#!/bin/bash

set +vx
NDMAPICFG=/home/cdadmin02/cdunix/ndm/cfg/cliapi/ndmapi.cfg
export NDMAPICFG

# Execute sel pro command
selpro_output=$(/home/cdadmin02/cdunix/ndm/bin/direct -s << EOJ
selpro;
EOJ
)

# Output the number of process in HOLD
count=$(echo "$selpro_output" | grep -c "HOLD" )
if [ $count -gt 0 ]; then
    echo "processos em HOLD - $count vezes:" > processo_HOLD.out
else
    echo "" > processo_HOLD.out
fi

# Output the number of process in WAIT
count=$(echo "$selpro_output" | grep -c "WAIT" )
if [ $count -gt 0 ]; then
    echo "processos em WAIT - $count vezes:" > processo_WAIT.out
else
    echo "" > processo_WAIT.out
fi


# Define process PNAME
strings=("COPY2SFG" "processo2" "processo3")

for str in "${strings[@]}"; do
    # conta HOLD ou WAIT e conta o processo
    count=$(echo "$selpro_output" | grep -e "HOLD" -e "WAIT" | grep -c "$str")

    if [ $count -gt 0 ]; then
        echo "O processo '$str' ocorre $count vezes:" > processo_"$str".out
    else
        echo "" > processo_"$str".out
    fi
done

Ver também