ITEM: M7095L

HACMP:stop_server script is failing on ed command.



Question:

Env:  AIX 3.2.5, HACMP 2.1

Desc:  When I try to bring down HACMP gracefully with takeover
       HACMP fails when bringing down the application servers.
       I have determined that the ed command has broken and 
       it is the cause of the failure of the stop_server script.
       The following script illustrates the failure of the ed
       command:

-----------------------------------------------------------------------------
 \#!/bin/sh
 \#
 \#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#
 \#
 \#    MEASUREX Management Systems Division
 \#
 \#    NAME:       bug_ed
 \#    PURPOSE:    script to illustrate bug with 'ed' which causes HACMP failures
 \#    AIX :       Version 3.2.5
 \#    HACMP :     Version 2.1  +  PTF U432018
 \#                             +  FIX for nfs soft mount error
 \#
 \#    COMMENTS :  The 'ed' editing runs properly on :
 \#
 \#    IBM RS/6000  with AIX V3.2.2 and V3.2.4
 \#                       DEC 5000/200 with Ultrix V4.2
 \#                       HP 9000/800  with HP-UX 9.04
 \#
 \#                The 'ed' editing fails on :
 \#
 \#    IBM RS/6000  with AIX V3.2.5
 \#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#
 \#
 \#
 \#    Description
 \#---------------------------------------------------------------------------
 \#  This script illustrates the problem with "ed" which causes
 \#  /usr/sbin/cluster/stop_server to trash the /usr/sbin/cluster/server.status
 \#  file when you remove the second of two lines in this file.
 \#
 \#  This prevents graceful shutdown with takeover. Since the server.status file
 \#  is empty, HACMP does not call the "stop_server" script to stop the user
 \#  application server running on the system.  Most likely, some user
 \#  is preventing the unmount/varyoffvg of the shared drive.  HACMP reports an
 \#  error and the second system never starts the takeover application resource.
 \#
 \#  If the call to "ed" is replaced by a call to "ex", then all is well.
 \#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#
 EDFILE=/tmp/junkfile.ed
 EXFILE=/tmp/junkfile.ex
 PATTERN="1 LAST_SERVER"

 echo "1 FIRST_SERVER"  >$EDFILE
 echo $PATTERN >>$EDFILE
 cp $EDFILE $EXFILE

 echo "\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#"
 echo "---------------------  USING  'ed'  TO EDIT  ----------------"
 echo "\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#"
 echo "ORIGINAL FILE        (LAST LINE IS $PATTERN)"
 echo "----------------     $EDFILE starts with next line"
 cat $EDFILE
 echo "----------------     $EDFILE ended with previous line"
 echo
 echo "REMOVING LAST LINE   using 'ed'"

                          JUNK=`ed $EDFILE \<\< EOF
                          /$PATTERN/d
                          w
                          q
                          .
                          EOF 2>/dev/null`

 echo "MODIFIED FILE"
 echo "----------------     $EDFILE starts with next line"
 cat $EDFILE
 echo "----------------     $EDFILE ended with previous line"
 echo
 echo ">>>>>  WHY DOES  ed  REMOVE BOTH LINES WHEN YOU DELETE THE LAST LINE???"
 echo
 echo
 echo
 echo "\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#"

 echo "---------------------  USING  'ex'  TO EDIT  ----------------"
 echo "\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#"
 echo "ORIGINAL FILE        (LAST LINE IS $PATTERN)"
 echo "----------------     $EXFILE starts with next line"
 cat $EXFILE
 echo "----------------     $EXFILE ended with previous line"
 echo
 echo "REMOVING LAST LINE   using 'ex'"

                          JUNK=`ex - $EXFILE \<\< EOF
                          /$PATTERN/d
                          w
                          q
                          EOF 2>/dev/null`

 echo "MODIFIED FILE"
 echo "----------------     $EXFILE starts with next line"
 cat $EXFILE
 echo "----------------     $EXFILE ended with previous line"
 echo
 echo ">>>>>  FORTUNATELY  ex  WORKS PROPERLY.  ONE SHOULD USE ex INSTEAD OF ed"
 echo
-----------------------------------------------------------------------------

Execution of the above script yields the following output:

\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#

---------------------  USING  'ed'  TO EDIT  ----------------
\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#

ORIGINAL FILE        (LAST LINE IS 1 LAST_SERVER)
----------------     /tmp/junkfile.ed starts with next line
1 FIRST_SERVER
1 LAST_SERVER
----------------     /tmp/junkfile.ed ended with previous line

REMOVING LAST LINE   using 'ed'
MODIFIED FILE
----------------     /tmp/junkfile.ed starts with next line
----------------     /tmp/junkfile.ed ended with previous line

>>>>>  WHY DOES  ed  REMOVE BOTH LINES WHEN YOU DELETE THE LAST LINE???


\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#

---------------------  USING  'ex'  TO EDIT  ----------------
\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#

ORIGINAL FILE        (LAST LINE IS 1 LAST_SERVER)
----------------     /tmp/junkfile.ex starts with next line
1 FIRST_SERVER
1 LAST_SERVER
----------------     /tmp/junkfile.ex ended with previous line

REMOVING LAST LINE   using 'ex'
MODIFIED FILE
----------------     /tmp/junkfile.ex starts with next line
1 FIRST_SERVER
----------------     /tmp/junkfile.ex ended with previous line

>>>>>  FORTUNATELY  ex  WORKS PROPERLY.  ONE SHOULD USE ex INSTEAD OF ed

Action:  APAR IX41248 which is fixed by PTF U428222.
NextAction: You are getting the fix via fixdist site.
         

Closing Call!


Support Line: HACMP:stop_server script is failing on ed command. ITEM: M7095L
Dated: September 1994 Category: N/A
This HTML file was generated 99/06/24~13:30:39
Comments or suggestions? Contact us