FishEye Documentation

FishEye 3.4 Documentation
FishEye 3.3 Documentation

FishEye 3.2 Documentation

More...  

 

FishEye Knowledge Base Resources

You're visiting the Fisheye and Crucible Knowledge Base. Visit the FishEye and Crucible Knowledge Base Home for an overview.

Skip to end of metadata
Go to start of metadata

Symptoms

FishEye and Crucible do not ship with scripts to start FishEye at system boot time.

Icon

System Administration tasks are not supported by Atlassian. These instructions are only provided as a guide and may not be up to date with the latest version of your operating system.

Resolution

  1. Create a new file /etc/init.d/fisheye with the following contents:

    /etc/init.d/fisheye
  2. Change the permissions as follows:

    sudo chmod 755 /etc/init.d/fisheye
  3. Add the script to the start up process:
    1. Ubuntu (and other Debian derivatives):

      sudo update-rc.d fisheye defaults
    2. RHEL and derivates:

Notes

This was tested with Ubuntu 8.10.

14 Comments

  1. On CentOS 5.3 I was getting an "At least one argument required." error.

    I fixed it by changing the following line

    to

    1. I had the same problem with Ubuntu 10.04 I just did the same thing as Adam and moved the $1 into the same string

      I also had to add the fisheye user with a home directory so I didn't get any nohup.out permission problems (it otherwise it tries to make the file in /)

      sudo useradd -d /home/fisheye -m fisheye
    2. What are the strings? This site is blank.

  2. Note, if you are following the Dragon tutorial, you need to account for FISHEYE_INST.  I made the following changes:

    # FISHEYE_HOME: The path to the FishEye installation. Its recommended to create a symbolic link to the latest version so
    # the process will still work after upgrades.
    FISHEYE_HOME="/srv/fisheye/latest"
    # FISHEYE_INST: The path where the data itself will be stored.
    # See Dragons Stage 5 - Install FishEye and Crucible Step 3
    export FISHEYE_INST="/srv/fisheye/fisheyecrucible"
          
    fisheyectl() {
            if [ "x$USER" != "x$RUN_AS" ]; then
                    su - "$RUN_AS" -c "FISHEYE_INST=$FISHEYE_INST $FISHEYE_HOME/bin/fisheyectl.sh $1"
            else
                    "$FISHEYE_HOME/bin/fisheyectl.sh" "$1"
            fi
    }

    Also, do not forget:

    chown -R fisheye /srv/fisheye

     

     

    1. Yes, it is crucial that the value of FISHEYE_INST be available inside fisheyectl.sh, which it won't necessarily be if it's set in /etc/environment (I'm not sure all Linux distros actually use that, and even if they do, I doubt most of them will pick up on changes to it without a reboot). I used su -m as opposed to su -, so in my case setting it and exporting it in the init script was sufficient.

       

  3. Here is a slightly more complete init script for ubuntu/debian. Use it as you will but I make no guarantees. (smile)

    #!/bin/bash
    . /lib/lsb/init-functions
    if [ "${USER}" != "root" ]; then
    echo "try running again as root."
    exit 1
    fi
    FISHEYE_USER="fisheye"
    FISHEYE_GROUP=`groups ${FISHEYE_USER} | cut -d: -f2 | awk '{ print $1 }'`
    FISHEYE_HOME="/opt/fisheye"
    FISHEYE_PID="/var/run/fisheye.pid"
    cd ${FISHEYE_HOME}
    if [ -L ${FISHEYE_HOME} ]; then
    FISHEYE_HOME=`readlink -f ${FISHEYE_HOME}`
    fi
    # fix the permissions
    chown -R ${FISHEYE_USER}:${FISHEYE_GROUP} ${FISHEYE_HOME}
    function fisheyectl() {
    if [ "$1" == "start" ] && `fisheye_started`; then return 0; fi
    if [ "$1" == "stop" ] && `fisheye_stopped`; then return 0; fi
    if [ "$USER" != "$FISHEYE_USER" ]; then
    su - "$FISHEYE_USER" -c "$FISHEYE_HOME/bin/fisheyectl.sh $1" &> /dev/null
    else
    $FISHEYE_HOME/bin/fisheyectl.sh $1 &> /dev/null
    fi
    if [ "$1" == "start" ]; then 
    sleep_til started
    get_pid > ${FISHEYE_PID}
    fi
    if [ "$1" == "stop" ]; then
    sleep_til stopped
    rm ${FISHEYE_PID}
    fi
    }
    function fisheye_started() {
    netstat -ln | grep -c '127.0.0.1:8059' &> /dev/null
    }
    function fisheye_stopped() {
    ! fisheye_started
    }
    function sleep_til() {
    while ! `fisheye_${1}`; do
    sleep 1
    x=$(($x+1))
    if [ $x -eq 10 ]; then
    log_end_msg 1
    exit 1
    fi
    done
    }
    function get_pid() {
    ps -ef | grep -v "grep" | grep "java" | grep "fisheyeboot.jar" | awk '{ print $2 }'
    }
    case "$1" in
    start)
    log_daemon_msg "Starting Fisheye" "fisheye"
    fisheyectl start
    log_end_msg 0
    ;;
    stop)
    log_daemon_msg "Stopping Fisheye" "fisheye"
    fisheyectl stop
    log_end_msg 0
    ;;
    restart)
    log_daemon_msg "Restarting Fisheye" "fisheye"
    fisheyectl stop
    fisheyectl start
    log_end_msg 0
    ;;
    status)
    status_of_proc -p ${FISHEYE_PID} /usr/bin/java fisheye && exit 0 || exit $?
    ;;
    *)
    echo "Usage: $0 {start|stop|restart|status}"
    ;;
    esac
    exit 0
  4. These are wrong: 

    if [ "x$USER" != "x$RUN_AS" ]; then
                    su - "$RUN_AS" -c "$FISHEYE_HOME/bin/fisheyectl.sh" "$1"
            else
                    "$FISHEYE_HOME/bin/fisheyectl.sh" "$1"
    These are correct for Ubuntu 12.04:
    if [ "x$USER" != "x$RUN_AS" ]; then
                    su - "$RUN_AS" -c "$FISHEYE_HOME/bin/fisheyectl.sh $1"
            else
                    "$FISHEYE_HOME/bin/fisheyectl.sh $1"
    Carlitos Melgar
    1. Your first correction is correct (in most situations), the second is not. Technically, if one wants to be totally consistent, it should be something like:

      if [ "x$USER" != "x$RUN_AS" ]; then 
          su - "$RUN_AS" -c "\"$FISHEYE_HOME/bin/fisheyectl.sh\" \"$1\""
      else
          "$FISHEYE_HOME/bin/fisheyectl.sh" "$1"
      fi

       

  5. There's a bug somewhere with args being passed on Linux systems ( FE-4639 - Command-line application start fails to pull $FISHEYE_ARGS (Linux only) Closed ) which the following script should fix

     

  6. chkconfig --add stash --level 0356

    Should be chkconfig --add fisheye --level 0356

  7. I created a system user in Ubuntu for the fisheye user (sudo useradd -r -s /bin/false USERNAME). In this case your "su" line needs to look like:

    su -m "$RUN_AS" -c "$FISHEYE_HOME/bin/fisheyectl.sh $1"

    Otherwise you'll get the error "No directory, logging in with HOME=/"

  8. I had to change that command to:

    sudo -u "$RUN_AS" "$FISHEYE_HOME/bin/fisheyectl.sh" "$1"
  9. if you got: "service fisheye does not support chkconfig" on redhat like distribs - add the following strings to the /etc/init.d/fisheye after #!/bin/bash:

    #!/bin/bash
    #Fisheye startup script
    #chkconfig: 2345 80 05
    #description: Fisheye

  10. I wrote an OpenRC initscript that does not use fisheyectl.sh but instead creates the command on its own (by default it uses the same parameters that fisheyectl.sh also uses)

    /etc/init.d/fisheye  Expand source
    /etc/conf.d/fisheye  Expand source