How do I get FISHEYE on Linux to start and stop as a service?

cliffordgormley
cliffordgormley used Ask the Experts™
on
Hi, (especially SILICONBRIT, if you see this!!)
I got the folllowing response from SILICONBRIT on how to get the FISHEYE application to run as a service.  Unfortunately, I closed the question because I knew it would take a few weeks before I could start working on it.
It looks like a nice step-by-step answser that a Linux newbie like me can follow, but I got stuck on the following part:
echo $FISHEYE_HOME
I do not get a response, so I guess the path does not exist.
What do I do now?
THanks!
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

Author

Commented:
oops, I forgot to add his instrutions.  Here they are:
Since you are a unix newbie, lets see if I can give you some more straightforward instructions.

First, make sure that fisheye is *not* running, however you normally do this.  You can test by going to the URL that you use to connect to fisheye.

Second, find the script I am talking about:  fisheyectl.sh

So, lets make sure that the FISHEYE_HOME variable is set:

   echo $FISHEYE_HOME

...should reveal a path.  If it doesn't, post back here.  If it is, you should be able to change directory to the fisheye home directory: $FISHEYE_HOME

  cd $FISHEYE_HOME

Now, you should be able to list the contents of the bin directory in this directory:

  ls ./bin

...and should be able to see a file 'fisheyectl.sh'.  If you *can't* find it, post back here.


OK - let's test that it works as expected:

   chmod +x ./bin/fisheyectl.sh
   ./bin/fisheyectl.sh start

If no error messages are given, you can test that fisheye is started by hitting the URL you normally use to connect.  If it doesn't start, or you get error messages, post back here.

Finally, lets test it stops:

   ./bin/fisheyectl.sh stop

One again, test with the URL

OK - Finally, we are in a position to setup the automated start/stop sequence when the server boots/shutsdown.

Change directory to the run-level 3 directory:

   cd /etc/rc3.d

Create startup and shutdown links:

   ln -s $FISHEYE_HOME/bin/fisheyectl.sh S55fisheye
   ln -s $FISHEYE_HOME/bin/fisheyectl.sh K55fisheye
   ls -l | grep fisheye

Note that you have created TWO links onto the same file.  This is because during startup, the initialisation daemon calls all scripts that begin with 'S' (for start), and on shutdown, all scripts that begin with 'K' (for kill).  

OK - To test your startup processes, you can reboot your server and see what happens.

Commented:


find /usr -name fisheyectl.sh -exec dirname {} \;
find /apps -name fisheyectl.sh -exec dirname {} \;
find /opt -name fisheyectl.sh -exec dirname {} \;
find /bin -name fisheyectl.sh -exec dirname {} \;
find /FISHEYE_HOME/ -name fisheyectl.sh -exec dirname {} \;
Once you get an output on the above commands, remove the /bin part...

FISHEYE_HOME=/directory/output/above/without/the/bin

Commented:
Clifford, all you did was repost what siliconbrit said word for word?
Ensure you’re charging the right price for your IT

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden using our free interactive tool and use it to determine the right price for your IT services. Start calculating Now!

Author

Commented:
Frashi.
Please read my first post.  In this post, I mentioned where I got stuck.  I posted siliconbrit's post as a reference so you could see what I was trying to accomplish.

I need to know what to do if I do not get a response to the 'echo $FISHEYE_HOME' command.

Author

Commented:
Ok, I was able to find the directory for the fisheye files by selecting the SYSINFO button on the web page.
FISHEYE_HOME's .\bin directory  has the following contents:
fisheyectl.bat
fisheyectl.sh
run.bat
run.sh
start.bat
start.sh
stop.bat
stop.sh

Now, acc. to siliconbrit's instructions, I should ishhed the following command:
chmod +x ./bin/fisheyectl.sh start

What does this command actually do.  I know that CHMOD changes permissions, but what does it do exactly here?

Newbie.

Author

Commented:
also, what does 'ctl' and 'sh' mean?
I assume 'sh' means script....

Author

Commented:
Ok, I think I am starting to understand what I am doing here.
The one thing I need to do though now is, create a path statement for $FISHEYE_HOME to point to its home directory.  I found out that its home directory is:  /home/joe/fisheye/fisheye_1.2.4.

How do I do this?

Thanks!
Commented:
*sheepish grin*

I'm sorry Cliff :) I thought you were another poster just copying and pasting siliconbrit's stuff!

I'll take the questions in order:

1. The chmod +x ./bin/fisheyectl.sh start
This command sets the 'execute' bit for owner, group and world for the files ./bin/fisheyectl.sh and start
I can't see how that line will work unless the directory you execute it in has the 'start' file as well. (It looks like that was meant to be run from $FISHEYE_HOME. if there is not a start file there, you need to do :
chmod +x ./bin/fisheyectl.sh ./bin/start

2. In unix, file extensions don't really have any 'real' usage other than convieince and ease of identification for sorting and such. the 'sh' extension generally means the file is a 'shell script' that is executed by /bin/sh.

3. I am assuming the ctl means 'control'. This nomenclature is similar to using 'apachectl' to start and stop the apache web service, etc. What this means in your case is this is the script that you use to start and stop Fisheye (I would assume)

4. To create a 'path statement': What you really want to do is set a variable named $FISHEYE_HOME to point to that path. Depending on your shell, you do it like this :

In bash (Most probably what you are using!), you do it like this
FISHEYE_HOME=/home/joe/fisheye/fisheye_1.2.4
export FISHEYE_HOME

In csh based shells, you do it like this :
setenv FISHEYE_HOME /home/joe/fisheye/fisheye_1.2.4

You can do these after logging in, or to make it permanant add it to the .profile (bash) or .{t}csh (for tcsh or csh)  file in the users direcory that is going to run Fisheye. (Additionally you can add it to /etc/profile (bash) /etc/csh.cshrc (csh) for all users to get it )

Author

Commented:
Hi Frashii
I am going to implement this on Wednesday.
Thanks for your response
I have a few questions regarding the following command:  chmod +x ./bin/fisheyectl.sh start
1. Does ths command have TWO arguments?  One of them being for the file 'fisheyectl.sh', and the other being for the file 'start'?
2. If the chmod +x command adds the execute bit for owner, group and world, how do you distinguish whether owner, group, or world, or any combination of them, is who you want to assign these permissions to?
3. I have the bash shell.  In your command 'export FISHEYE_HOME', what does the 'export' part do?  Is it reallyl necessary?
Thanks!

Commented:
1. yes :)
2. the +x will add it to all 3. To have it be more granular (in this case give group execute):
Note the term 'add'.. the + sign means 'set x and leave everything else alone:
Group Only:  chmod g+x ./bin/fisheyectl.sh start
Other Only:   chmod o+x
user (owner) and group : chmod ug+x ./bin/fisheyectl.sh start

User (Owner) has full permissions,group has read and other has nothing (note the equal sign.. we are setting it absolutly, not granting them additoional): chmod u=rwx,g=r,o= ./bin/fisheyectl.sh start

Permissions can also be specified numerically (octal) the above example would be :
chmod 740

take a look at :
http://en.wikipedia.org/wiki/Chmod

3. The export part of that command makes the variable an environmental variable so that any spawned shells (running a program or command) will inherit it. If you do not export it, it will not be 'passed down': here is an example:

I created a script that echos (prints) the contents of a variable and it looks like this :

frashii-vm:~# cat export_demo.sh
#!/bin/bash
echo $TESTVARIABLE

Now... in my shell I set the variable and then echo it, then I run the script notice that the script does not inherit the variable.

frashii-vm:~# TESTVARIABLE="Hello, World"
frashii-vm~# echo $TESTVARIABLE
Hello, World
ibex-cleanbuild:~# ./export_demo.sh

Now, I do the exact same thing, but I export the variable:

frashii-vm:~# export TESTVARIABLE="Hello, World"
frashii-vm~# echo $TESTVARIABLE
Hello, World
ibex-cleanbuild:~# ./export_demo.sh
Hello, World

I hope that helps :)

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial