0

Hi guys the problem is pretty simple I just don't know how to solve this in bash. I want to write simple mule server status checker. I can check it using command:

./mule status

Then I receive to possible communicates:

If all ok:

MULE_HOME is set to /home/mule/mule
Mule is running (3496).

And if not ok:

MULE_HOME is set to /home/mule/mule
Mule is not running.

How can I catch this communicates and for example do simple if / else with - eq

user3353393
  • 139
  • 3
  • 12

1 Answers1

0

The standard for that is using exitcodes, like all standard executable do. The program needs to use "exit" (without quotes) with some value. The receiver needs to evaluate "$?" (without quotes)

tvCa
  • 796
  • 6
  • 13
  • I just don't get how to write response of running /home/mule/bin/mule status to variable – user3353393 Nov 25 '14 at 15:53
  • You'll understand when reading this : http://stackoverflow.com/questions/6834487/what-is-the-variable-in-shell-scripting - It's an internal Unix/Linux function, and a great one ! – tvCa Nov 25 '14 at 16:02