Uploaded image for project: 'Dev - Nexus Repo'
  1. Dev - Nexus Repo
  2. NEXUS-6682

Wrong exit status in Java Service Wrapper sh script

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.8.1
    • Fix Version/s: 2.9
    • Component/s: Bootstrap
    • Labels:
      None
    • Environment:
      CentOS 6.5

      Description

      Hi,

      I've noticed this behaviour after configuring and installing the Java Service Wrapper sh script as /etc/init.d/nexus.

      1) Make sure that nexus is stopped
      2) As root, run "/etc/init.d/nexus status"
      3) We get a message saying "Nexus OSS is not running", but the exit status is 0
      4) As the nexus user, run "/etc/init.d/nexus status"
      5) We get a message saying "Nexus OSS is not running" and the exit status is 1

      The problem seems to be that the checkUser() function will run the status function as the correct user, but discards the exit status, using instead "exit 0" a couple of lines later. This doesn't happen if the user is correct.

                 # Still want to change users, recurse.  This means that the user will only be
                  #  prompted for a password once. Variables shifted by 1
                  su - $RUN_AS_USER -c "\"$REALPATH\" $2"
      
                  # Now that we are the original user again, we may need to clean up the lock file.
                  if [ "X$LOCKPROP" != "X" ]
                  then
                      getpid
                      if [ "X$pid" = "X" ]
                      then
                          # Wrapper is not running so make sure the lock file is deleted.
                          if [ -f "$LOCKFILE" ]
                          then
                              rm "$LOCKFILE"
                          fi
                      fi
                  fi
      
                  exit 0
      

        Attachments

          Activity

            People

            Assignee:
            Unassigned
            Reporter:
            henriquer Henrique Rodrigues
            Last Updated By:
            Peter Lynch
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Date of First Response:

                tigCommentSecurity.panel-title