IBM Sterling Connect:Direct : Script to get process in HOLD and WAIT queue
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