Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#!/bin/bash
# FISHEYE_HOME: The path to the FishEye installation. It's recommended to create a symbolic link to the latest version so
# the process will still work after upgrades. Be sure to update the symlink itself when upgrading.
# Example: ln -s /usr/local/atlassian/applications/fisheye/4.2.0 /usr/local/atlassian/applications/fisheye/latest
FISHEYE_HOME="/mnt/fecru-3.9.1"
# FISHEYE_INST: The path to store Fisheye data.
# The 2 lines below should be uncommented only if you don't have the environment variables set in /etc/environment file.
export FISHEYE_INST="/mnt/fecru-3.9.1_fisheye_data"
mkdir -p $FISHEYE_INST || sudo mkdir -p $FISHEYE_INST
fisheyectl() {
if [ ! -f "$FISHEYE_HOME/fisheyeboot.jar" ] ; then
echo "Error: Could not find $FISHEYE_HOME/fisheyeboot.jar"
exit 1
fi
"$FISHEYE_HOME/bin/fisheyectl.sh" "$1"
}
case "$1" in
start)
fisheyectl start
;;
stop)
fisheyectl stop
;;
restart)
fisheyectl stop
sleep 10
fisheyectl start
;;
status)
fecru_pid=$(ps -eAf|grep fecru|grep -v grep|sed "s/[ \t][ \t]*/ /g"|cut -d" " -f2|head -1)
if [[ -n "${fecru_pid}" ]];
then
echo "Process 'fecru' fisheye/crucible is running. PID (${fecru_pid})"
else
echo "Process 'fecru' fisheye/crucible is NOT running."
fi
;;
*)
echo "Usage: $0 {start|stop|status|restart}"
esac
echo "- Log files are available here:"
if [[ -n "${FISHEYE_INST}" ]];
then
echo "$(find "${FISHEYE_INST}/var/log" 2>/dev/null | sed "s/^/ /")";
else
echo "$(find "${FISHEYE_HOME}/var/log" 2>/dev/null | sed "s/^/ /")"
fi
echo
exit 0
@asangal
Copy link
Author

asangal commented Mar 2, 2017

This is already running on the code.wavefront.com server (10.255.0.5)

From bastion:

arun@bastion:~$ ssh 10.255.0.5

root@code:/mnt/fecru-3.9.1# pwd
/mnt/fecru-3.9.1
root@code:/mnt/fecru-3.9.1# ps -eAf|grep fisheye
root      1284     1  1 Feb10 ?        04:55:19 /usr/bin/java -Xmx1024m -Dfisheye.library.path= -Dfisheye.inst=/mnt/fecru-3.9.1 -Djava.awt.headless=true -Djava.endorsed.dirs=/mnt/fecru-3.9.1/lib/endorsed -jar /mnt/fecru-3.9.1/fisheyeboot.jar start
root      6452  5990  0 01:11 pts/1    00:00:00 grep --color=auto fisheye
root@code:/mnt/fecru-3.9.1#

I created the above init.d script and it can be placed as: /etc/init.d/fisheye

  1. Do we need a new user fisheye or can we just use ubuntu or root?

Then run:

  1. sudo chmod 755 /etc/init.d/fisheye
  2. chkconfig --add fisheye --level 0356

If it works, we can have an Ansible playbook to take care of putting the init.d file (template) and make sure it's started/enabled.

@mzeier
Copy link

mzeier commented Mar 2, 2017

I don't know enough but if the existing process is running as root, might keep it that way only because there's probably some file that you'd lose read/write access to.

Unless you can do testing of this instance elsewhere with a different user?

@asangal
Copy link
Author

asangal commented Mar 3, 2017

Updated /etc/init.d/fisheye file. Yea, without root user it was having some perm issues. The new version worked fine.

vagrant@myubuntuvagrant:~$ sudo service fisheye status
Process 'fecru' fisheye/crucible is running. PID (4243)
- Log files are available here:
  /mnt/fecru-3.9.1_fisheye_data/var/log/atlassian-fisheye-2017-03-03.log
  /mnt/fecru-3.9.1_fisheye_data/var/log/atlassian-fisheyectl-2017-03-03.log
  /mnt/fecru-3.9.1_fisheye_data/var/data/crudb/crucible.log
  /mnt/fecru-3.9.1_fisheye_data/analytics-logs/44549429a0e34feeba92311c77fdc451.atlassian-analytics.log

vagrant@myubuntuvagrant:~$ sudo service fisheye stop
INFO  - Using log4j configuration file: /mnt/fecru-3.9.1/log4j-client.xml
INFO  - FishEye arguments: []
FishEye Shutdown successfully
vagrant@myubuntuvagrant:~$ 
vagrant@myubuntuvagrant:~$ sudo service fisheye start
Starting FishEye/Crucible... Output redirected to /mnt/fecru-3.9.1_fisheye_data/var/log/fisheye.out
root


vagrant@myubuntuvagrant:~$ sudo service fisheye status
Process 'fecru' fisheye/crucible is running. PID (4639)
- Log files are available here:
  /mnt/fecru-3.9.1_fisheye_data/var/log/atlassian-fisheye-2017-03-03.log
  /mnt/fecru-3.9.1_fisheye_data/var/log/atlassian-fisheyectl-2017-03-03.log
  /mnt/fecru-3.9.1_fisheye_data/var/data/crudb/crucible.log
  /mnt/fecru-3.9.1_fisheye_data/analytics-logs/44549429a0e34feeba92311c77fdc451.atlassian-analytics.log

Fisheye Login page on my Mac machine: http://192.168.0.60:8160/setup/FishEyeLicense-view.do
Port 8060 (Fisheye's port on guest VM is mapped to port 8160 on my Host Mac machine)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment