1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
#!/bin/bash PROG="${BLOCK_INSTANCE:-i3}" PROG_REGEX="["$(echo "${PROG}" | cut -c 1)"]"$(echo "${PROG}" | cut -c 2-)" " PROCESS=$(ps -eo pid,cmd | grep -w ${PROG_REGEX}) if [[ "${PROCESS}" ]]; then echo "ok" echo "ok" echo "" else echo "na" echo "na" echo "" exit 33 fi