[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#562583: apache2.2-common: new init.d script pidof_apache function



Package: apache2.2-common
Version: 2.2.14-3
Severity: wishlist

Hi,

please consider this new pidof_apache function for the init.d script:

pidof_apache() {
    # if there is actually an apache2 process whose pid is in PIDFILE,
    # print it and return 0.
    if [ -e "$PIDFILE" ]; then
      if pidof apache2 | tr ' ' '\n' | grep $(cat $PIDFILE); then
        return 0
      else
        return 1
      fi
    fi
    return 1
}

This has the advantage of not explicitly iterating through all existing
apache2 processes, which makes -x output much easier readable. I am
sure that the if construct can be written more elegantly though.

Greetings
Marc



Reply to: