Issue Details (XML | Word | Printable)

Key: DIRSERVER-730
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Alex Karasulu
Reporter: Michael Henry
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Directory ApacheDS

init script fails due to missing commands "success" and "failure"

Created: 07/Sep/06 04:46 AM   Updated: 13/Feb/07 06:33 PM
Return to search
Component/s: None
Affects Version/s: 1.0-RC4
Fix Version/s: 1.5.0, 1.0.1

Time Tracking:
Not Specified

File Attachments:
  Size
Text File Licensed for inclusion in ASF works apacheds-daemon-trunk-serverinit.patch 2006-09-29 01:52 PM Bastiaan Bakker 3 kB
Environment: OpenSuSE 10.0

Resolution Date: 13/Feb/07 06:33 PM


 Description  « Hide
Here is the output for startup:

samsara:~ # /etc/init.d/apacheds start
JAVA_HOME=/usr/lib/jvm/java
APACHEDS_HOME=/usr/local/apacheds-1.0_RC4
CLASSPATH=:/usr/lib/jvm/java/lib/tools.jar:/usr/local/apacheds-1.0_RC4/bin/bootstrapper.jar:/usr/local/apacheds-1.0_RC4/bin/logger.jar:/usr/local/apacheds-1.0_RC4/bin/daemon.jar
Starting apacheds server: /etc/init.d/apacheds: line 155: success: command not found
/etc/init.d/apacheds: line 156: failure: command not found

...and shutdown:

samsara:/etc/init.d # ./apacheds stop
JAVA_HOME=/usr/lib/jvm/java
APACHEDS_HOME=/usr/local/apacheds-1.0_RC4
CLASSPATH=:/usr/lib/jvm/java/lib/tools.jar:/usr/local/apacheds-1.0_RC4/bin/bootstrapper.jar:/usr/local/apacheds-1.0_RC4/bin/logger.jar:/usr/local/apacheds-1.0_RC4/bin/daemon.jar
Shutting down apacheds server: ./apacheds: line 188: success: command not found
./apacheds: line 189: failure: command not found

Both cases have the exact same problem so I will just cover the startup case.

Lines 155 and 156 are:

        [ "$RETVAL" -eq 0 ] && success $"apacheds server startup" || \
             failure $"apacheds server start"

My guess is that "success" and "failure" are functions which are expected to be defined in the following which starts at line 14:

# Source function library.
if [ -f /etc/init.d/functions ] ; then
     . /etc/init.d/functions
fi

The file /etc/init.d/functions doesn't exist on SuSE platforms.

A possible fix would be to define a variable such as "FUNCTIONS_EXIST=true" inside the if statement and systems for which the functions do not exist could be lumped in with SunOS in the switch statements.

*** apacheds Thu Sep 7 14:39:26 2006
--- apacheds.old Thu Sep 7 14:36:44 2006
***************
*** 11,20 ****
  export DISPLAY

  # Source function library.
- FUNCTIONS_EXIST=false
  if [ -f /etc/init.d/functions ] ; then
       . /etc/init.d/functions
- FUNCTIONS_EXIST=true
  fi

  # Source networking configuration.
--- 11,18 ----
***************
*** 150,156 ****
      if [ `uname` = "Darwin" ] ; then
          [ "$RETVAL" -eq 0 ] && echo successful apacheds server startup || \
               echo failed apacheds server start
! elif [ `uname` = "SunOS" ] || ! $FUNCTIONS_EXIST; then
          [ "$RETVAL" -eq 0 ] && echo success apacheds server startup || \
               echo failure apacheds server start
      else
--- 148,154 ----
      if [ `uname` = "Darwin" ] ; then
          [ "$RETVAL" -eq 0 ] && echo successful apacheds server startup || \
               echo failed apacheds server start
! elif [ `uname` = "SunOS" ] ; then
          [ "$RETVAL" -eq 0 ] && echo success apacheds server startup || \
               echo failure apacheds server start
      else
***************
*** 181,187 ****
      if [ `uname` = "Darwin" ] ; then
          [ "$RETVAL" -eq 0 ] && echo successful apacheds server shutdown || \
               echo failed apacheds server shutdown
! elif [ `uname` = "SunOS" ] || ! $FUNCTIONS_EXIST; then
          [ "$RETVAL" -eq 0 ] && echo success apacheds server shutdown || \
               echo failure apacheds server shutdown
      else
--- 179,185 ----
      if [ `uname` = "Darwin" ] ; then
          [ "$RETVAL" -eq 0 ] && echo successful apacheds server shutdown || \
               echo failed apacheds server shutdown
! elif [ `uname` = "SunOS" ] ; then
          [ "$RETVAL" -eq 0 ] && echo success apacheds server shutdown || \
               echo failure apacheds server shutdown
      else
EOF




 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Alex Karasulu added a comment - 18/Sep/06 12:25 PM
Which installer did you use to intall ApacheDS?

Bastiaan Bakker added a comment - 29/Sep/06 01:52 PM
the attached patch tackles the issue by replacing 'success' and 'failure' with 'log_success_msg' and 'log_failure_msg' from LSB. Since OpenSUSE is LSB compliant this should work on SUSE as well.
In case LSB is not available the script falls back to using 'echo -n success' and 'echo -n failure'.
Other changes:
* use /bin/sh instead of /bin/bash
return $RETVAL instead of $? because $? may be overwritten by the log functions.

Alex Karasulu added a comment - 02/Oct/06 03:22 AM
I'll take care of this later. Will need to build and test with SUSE.

Michael Henry added a comment - 14/Oct/06 02:46 AM

   [[ Old comment, sent by email on Mon, 18 Sep 2006 23:08:34 +1000 (EST) ]]

I installed apacheds-1.0-RC4-linux-i386.rpm from the command line.



http://issues.apache.org/jira/browse/DIRSERVER-730?page=comments#action_12435467
CLASSPATH=:/usr/lib/jvm/java/lib/tools.jar:/usr/local/apacheds-1.0_RC4/bin/bootstrapper.jar:/usr/local/apacheds-1.0_RC4/bin/logger.jar:/usr/local/apacheds-1.0_RC4/bin/daemon.jar
CLASSPATH=:/usr/lib/jvm/java/lib/tools.jar:/usr/local/apacheds-1.0_RC4/bin/bootstrapper.jar:/usr/local/apacheds-1.0_RC4/bin/logger.jar:/usr/local/apacheds-1.0_RC4/bin/daemon.jar


--
Michael Henry

    Men are born ignorant, not stupid.
    They are made stupid by education.
        --Bertrand Russell



____________________________________________________
Do you Yahoo!?
The new Yahoo!7 TV home page features highlights and popular picks
http://au.tv.yahoo.com/tv/

Emmanuel Lecharny added a comment - 25/Jan/07 04:08 PM
Should also be fixed for 1.5.0

Emmanuel Lecharny added a comment - 04/Feb/07 12:45 PM
It would be very confortable to have a single shell script for all the Unix system spreaded all over the world, but sadly, each flavor has its own set of commun functions.

This is *bad*. This is one of the reason why W$ rules. Ok, that's another problem.

I suggest that we have more than one installer, for each major Unix flavored system :
- one for macOSX which is BSD based
- one for Solaris
- one for Suse based
- one for RedHat based
- one for Debian based

This will help to manage these kind of issues, as we won't have to test a fix on N different system.

wdyt ?

Alex Karasulu added a comment - 13/Feb/07 06:14 PM
For a quick workaround fix for the time being I will check for these RH only success or failure commands in the script and remove them.

Alex Karasulu added a comment - 13/Feb/07 06:33 PM
Committed revision 507141 on 1.0 branch here:

   http://svn.apache.org/viewvc?view=rev&revision=507141

Committed revision 507143 on 1.5 branch (trunk) here:

   http://svn.apache.org/viewvc?view=rev&revision=507143

Note that I could not apply the supplied patches because they seemed a bit out of date and were garbled up by JIRA: attach a patch to avoid these problems instead of putting them in a comment or description.

I took your advice and made the following fixes:

 o all server.init scripts now return $RETVAL instead of $?
 o scripts targeting non-rpm based distros use /bin/sh instead of /bin/bash

It seems as though I already removed the calls to success and failure which are specific to RH distros. Now there is a simple echo of success or failure instead of using these functions.

Just for the record these scripts are really aweful. They were put together rapidly and should probably be rewritten.