Correctly determine current state in init script

If two stop actions are ever performed simultaneously, then neither will terminate.
With the default implementaiton of __pids_pidof, the status() function from 
/etc/init.d/functions incorrectly thinks the other stop action is a real 
corosync process.


git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@2639 fd59a12c-fef9-0310-b244-a6a79926bd2f
This commit is contained in:
Andrew Beekhof 2009-12-15 11:52:48 +00:00
parent ec6e57dd42
commit e725dd3edd

View File

@ -62,6 +62,15 @@ if [ -d @SYSCONFDIR@/default ]; then
[ -z "$LOCK_FILE" ] && LOCK_FILE="@LOCALSTATEDIR@/lock/$prog"
fi
# The version of __pids_pidof in /etc/init.d/functions calls pidof with -x
# This means it matches scripts, including this one.
# Redefine it here so that status (from the same file) works.
# Otherwise simultaneous calls to stop() will loop forever
__pids_pidof() {
pidof -c -o $$ -o $PPID -o %PPID "$1" || \
pidof -c -o $$ -o $PPID -o %PPID "${1##*/}"
}
start()
{
echo -n "Starting $desc ($prog): "