Hello list, 

I still have problem with my heartbeat-config

I want heartbeat to start AFD. I checked the RA for LSB-compatibility
and think that it's right now.

The log file says, that the bash does not find the command afd.


crmd[2725]: 2008/02/29_11:32:00 info: do_lrm_rsc_op: Performing
op=AFD_start_0 key=5:1:71d7b119-77c3-4e6b-9ac6-6acf20d8cf61)
lrmd[2722]: 2008/02/29_11:32:01 info: rsc:AFD: start
lrmd[2785]: 2008/02/29_11:32:01 WARN: For LSB init script, no additional
parameters are needed.
lrmd[2722]: 2008/02/29_11:32:01 info: RA output: (AFD:start:stdout)
Starting AFD for afdha :
lrmd[2722]: 2008/02/29_11:32:01 info: RA output: (AFD:start:stderr)
bash: afd: command not found

tengine[2773]: 2008/02/29_11:32:01 info: extract_event: Aborting on
transient_attributes changes for 44425bd9-2cba-4d6a-ac62-82a8bb81a23d
lrmd[2722]: 2008/02/29_11:32:01 info: RA output: (AFD:start:stdout)
Failed

tengine[2773]: 2008/02/29_11:32:01 info: update_abort_priority: Abort
priority upgraded to 1000000
crmd[2725]: 2008/02/29_11:32:01 ERROR: process_lrm_event: LRM operation
AFD_start_0 (call=3, rc=1) Error unknown error
tengine[2773]: 2008/02/29_11:32:01 info: update_abort_priority: Abort
action 0 superceeded by 2
tengine[2773]: 2008/02/29_11:32:01 WARN: status_from_rc: Action start on
noderz failed (target: <null> vs. rc: 1): Error
tengine[2773]: 2008/02/29_11:32:01 WARN: update_failcount: Updating
failcount for AFD on 91d062c3-ad0a-4c24-b759-acada7f19101 after failed
start: rc=1

There is an extra user for AFD, called afdha. The afdha-script is
attached.

Switching to to afdha via su afdha I can start AFD, so I don't
understand, where's the problem. (

A little help would be great.

Thanks
Florian

#!/bin/sh
#
# afd:       Starts the AFD
#
# chkconfig: 235 70 10
# description: AFD is an automatic file distributor and collector. It is \
#              used to distribute data files via FTP, FTPS, SFTP, SMTP \
#              and/or SCP. It collects files via FTP, FTPS, SFTP, HTTP \
#              and/or HTTPS.
### BEGIN INIT INFO
# Required-Start: $local_fs $network
# Required-Stop: $local_fs $network
# Default-Start: 2 3 5
# Default-Stop: 0 1 6
# Short-Description: Starts the AFD
# Description: AFD is an automatic file distributor and collector. It is
#              used to distribute data files via FTP, FTPS, SFTP, SMTP
#              and/or SCP. It collects files via FTP, FTPS, SFTP, HTTP
#              and/or HTTPS.
### END INIT INFO


CURRENT_SCRIPT_NAME="`basename $0`"
if [ -r /etc/sysconfig/afd ]
then
   if [ "$CURRENT_SCRIPT_NAME" = "afdha" ]
   then
      AFD_USERS="`grep \^AFD_HA_USER_ /etc/sysconfig/afd | cut -d '=' -f2`"
   else
      AFD_USERS="`grep \^AFD_USER_ /etc/sysconfig/afd | cut -d '=' -f2`"
   fi
else
   AFD_USERS=""
fi


# See how we were called.
case "$1" in
  start)
        RETVAL=1
        for afduser in $AFD_USERS
        do
           echo -n "Starting AFD for $afduser : "
           su $afduser -c "afd -a"
           if [ $? -eq 0 ]
           then
              RETVAL=0
              touch /var/lock/subsys/afd.$afduser
              echo "Done"
           else
              RETVAL=0
              echo "Failed, cause AFD is already running"
           fi
        done
        [ $RETVAL -eq 0 ] && touch /var/lock/subsys/afd
        ;;
  stop)
        RETVAL=1
        for afduser in $AFD_USERS
        do
           echo -n "Stopping AFD for $afduser : "
           su $afduser -c "afd -S"
           case $? in
              0)
                 RETVAL=0
                 rm -f /var/lock/subsys/afd.$afduser
                 echo "Done"
                 ;;
              10)
                 RETVAL=0
                 rm -f /var/lock/subsys/afd.$afduser
                 echo "Is already stopped"
                 ;;
              *)
                 echo "Failed"
                 ;;
           esac
        done
        [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/afd
        ;;
  restart)
        $0 stop
        sleep 2
        $0 start
        RETVAL=$?
        ;;
  condrestart)
        RETVAL=1
        for afduser in $AFD_USERS
        do
           if [ -f /var/lock/subsys/restart_afd.$afduser ]
           then
              echo -n "Starting AFD for $afduser : "
              su $afduser -c "afd -a"
              if [ $? -eq 0 ]
              then
                 RETVAL=0
                 touch /var/lock/subsys/afd.$afduser
                 echo "Done"
              else
                 echo "Failed"
              fi
              rm -f /var/lock/subsys/restart_afd.$afduser
           else
              su $afduser -c "afd -S"
              if [ $? -eq 0 ]
              then
                 sleep 2
                 su $afduser -c "afd -a"
                 if [ $? -eq 0 ]
                 then
                    RETVAL=0
                    touch /var/lock/subsys/afd.$afduser
                    echo "Done"
                 else
                    echo "Failed"
                 fi
              fi
           fi
        done

        if [ ! "$CURRENT_SCRIPT_NAME" = "afdha" ]
        then
           # HA users may only be started if we find a restart_afd.user file!
           if [ -r /etc/sysconfig/afd ]
           then
              AFD_HA_USERS="`grep \^AFD_HA_USER_ /etc/sysconfig/afd | cut -d 
'=' -f2`"
           fi
           for afduser in $AFD_HA_USERS
           do
              if [ -f /var/lock/subsys/restart_afd.$afduser ]
              then
                 echo -n "Starting AFD for $afduser : "
                 su $afduser -c "afd -a"
                 if [ $? -eq 0 ]
                 then
                    RETVAL=0
                    touch /var/lock/subsys/afd.$afduser
                    echo "Done"
                 else
                    echo "Failed"
                 fi
                 rm -f /var/lock/subsys/restart_afd.$afduser
              fi
           done
        fi
        rm -f /var/lock/subsys/afd.restart
        ;;
  status)
        NOT_RUNNING=""
        IS_RUNNING=""
        for afduser in $AFD_USERS
        do
           su $afduser -c "afd -c"
           RETVAL=$?
           if [ $RETVAL -ne 5 ]
           then
              NOT_RUNNING="`echo $NOT_RUNNING` $afduser"
           else
              IS_RUNNING="`echo $IS_RUNNING` $afduser"
           fi
        done
        if [ "$NOT_RUNNING" = "" ]
        then
           echo "AFD for $IS_RUNNING is running."
           RETVAL=0
        else
           echo "AFD for $NOT_RUNNING is NOT active."
           RETVAL=3
        fi
        ;;
  *)
        echo "*** Usage: afd {start|stop|restart|condrestart|status}"
        RETVAL=1
        ;;
esac

exit $RETVAL
_______________________________________________
Linux-HA mailing list
Linux-HA@lists.linux-ha.org
http://lists.linux-ha.org/mailman/listinfo/linux-ha
See also: http://linux-ha.org/ReportingProblems

Reply via email to