Monit - script not being executed as expected

Posted by Thaís on Server Fault See other posts from Server Fault or by Thaís
Published on 2012-06-29T00:03:43Z Indexed on 2012/06/29 3:17 UTC
Read the original article Hit count: 474

Filed under:

I'm working on a Windows 7 machine, having a VM for Ubuntu (image disk: 12.04-desktop-i386.iso).

On the VM I installed Monit 5.3.2, and configured some processes and applications. So I created a script to run my application. This application should display some content on the screen (Im basically displaying two images, using Feh).

The thing is: if I call my script through the command line, it runs ok, and display the images. But if I run through monit, it seems to be running ok, but it doesn't display the images.In the case I try to debug it (remote debug), then I can see the images. So I was supposing this could be some kind of configuration, but didn't find out what (even using the option -I wou'ldn't work).

I"m showing below more details:

-Piece of script on Monit----

check program runMediaHandler with path "/usr/bin/runMediaHandler.sh"
 if status == 1 then alert

-runMediaHandler.sh ----

#!/bin/bash
java -jar /home/thais/Desktop/MediaHandler_RC2.jar

Summarizing:

1.What works:

  • if I run java directly: java -jar /home/thais/Desktop/MediaHandler_RC2.jar

  • if I run the script directly: runMediaHandler.sh

  • if I remote debug putting a breakpoint where the image should be displayed

2.What does not work:

  • putting that piece of information on Monit to "check program", writen above (even if calling monit -I start runMediaHandler)

Thank you in advance,

Thaís

© Server Fault or respective owner

Related posts about monit