Uploaded image for project: 'Bitbucket Data Center'
  1. Bitbucket Data Center
  2. BSERV-5174

stash service is starting as root

    XMLWordPrintable

Details

    • Bug
    • Resolution: Cannot Reproduce
    • Medium
    • None
    • 3.1.3
    • Administration
    • linux 64 bits

    Description

      When I restart the stash server, the service is started as root.

      Using init.d script:

      #! /bin/sh
      
      ### BEGIN INIT INFO
      # Provides:          stash
      # Required-Start:    $remote_fs $syslog
      # Required-Stop:     $remote_fs $syslog
      # Default-Start:     2 3 4 5
      # Default-Stop:      0 1 6
      # Short-Description: Initscript for Atlassian Stash
      # Description:  Automatically start Atlassian Stash when the system starts up.
      #               Provide commands for manually starting and stopping Stash.
      ### END INIT INFO
      
      # Adapt the following lines to your configuration
      # RUNUSER: The user to run Stash as.
      RUNUSER=stash
      
      # STASH_INSTALLDIR: The path to the Stash installation directory
      STASH_INSTALLDIR="/opt/atlassian-stash-latest"
      
      # STASH_HOME: Path to the Stash home directory
      STASH_HOME="/git/stash-home"
      
      # =============================================================================$
      # =============================================================================$
      # =============================================================================$
      
      # PATH should only include /usr/* if it runs after the mountnfs.sh script
      PATH=/sbin:/usr/sbin:/bin:/usr/bin
      DESC="Atlassian Stash"
      NAME=stash
      PIDFILE=$STASH_INSTALLDIR/work/catalina.pid
      SCRIPTNAME=/etc/init.d/$NAME
      
      # Read configuration variable file if it is present
      [ -r /etc/default/$NAME ] && . /etc/default/$NAME
      
      # Define LSB log_* functions.
      
      # To be replaced by LSB functions
      # Defined here for distributions that don't define
      # log_daemon_msg
      log_daemon_msg () {
          echo $@
      }
      
      # To be replaced by LSB functions
      # Defined here for distributions that don't define
      # log_end_msg
      log_end_msg () {
          retval=$1
          if [ $retval -eq 0 ]; then
              echo "."
          else
              echo " failed!"
          fi
          return $retval
      }
      
      # Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
      . /lib/lsb/init-functions
      
      
      run_with_home() {
          if [ "$RUNUSER" != "$USER" ]; then
              su - "$RUNUSER" -c "export STASH_HOME=${STASH_HOME};${STASH_INSTALLDIR}$
          else
              export STASH_HOME=${STASH_HOME};${STASH_INSTALLDIR}/bin/$1
          fi
      }
      
      #
      # Function that starts the daemon/service
      #
      do_start()
      {
          run_with_home start-stash.sh
      }
      
      #
      # Function that stops the daemon/service
      #
      do_stop()
      {
          if [ -e $PIDFILE ]; then
            run_with_home stop-stash.sh
          else
            log_failure_msg "$NAME is not running."
          fi
      }
      
      
      case "$1" in
        start)
          [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
          do_start
          case "$?" in
              0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
              2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
          esac
          ;;
        stop)
          [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
          do_stop
          case "$?" in
              0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
              2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
          esac
          ;;
        status)
             if [ ! -e $PIDFILE ]; then
               log_failure_msg "$NAME is not running."
               return 1
             fi
             status_of_proc -p $PIDFILE "" $NAME && exit 0 || exit $?
             ;;
        restart|force-reload)
          #
          # If the "reload" option is implemented then remove the
          # 'force-reload' alias
          #
          log_daemon_msg "Restarting $DESC" "$NAME"
          do_stop
          case "$?" in
            0|1)
              do_start
              case "$?" in
                  0) log_end_msg 0 ;;
                  1) log_end_msg 1 ;; # Old process is still running
                  *) log_end_msg 1 ;; # Failed to start
              esac
              ;;
            *)
              # Failed to stop
              log_end_msg 1
              ;;
          esac
          ;;
        *)
          echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2
          exit 3
          ;;
      esac
      
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            6e6553b405b9 Flavio Beck
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: