Tugger the SLUGger!SLUG Mailing List Archives

Re: [SLUG] bash question - how to tell if apache has stopped?


This one time, at band camp, Michael Lake wrote:
>What do folks use to determine if a process is running?

service x status

ps -C process

pidof

kill -0 $pid

I use the last one in a test harness to wait until postgres has
started up:

# this am teh sucks
i=0
max=60
until "$PSQL" -X -h $work template1 </dev/null 2>/dev/null ; do
    i=$(($i + 1))
    if [ $i -ge $max ]; then
        break
    fi
    if kill -0 "$postmaster_pid" >/dev/null 2>&1 ; then
        : still starting up
    else
        break
    fi
    sleep 1
done
if ! kill -0 "$postmaster_pid" >/dev/null 2>&1 ; then
    cat $work/postmaster.log
    no_result
fi

(probably doens't answer your question though :)