#!/bin/bash PROGS="smartPDU snmpd Qt_Test" while true; do sleep 5 for n in $PROGS do if ! pgrep $n > /dev/null ; then echo "$n is not running, start it now ..." /etc/init.d/S90PDUApp start $n fi done done