Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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/"
 if status == 1 then alert ----

java -jar /home/thais/Desktop/MediaHandler_RC2.jar


1.What works:

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

  • if I run the script directly:

  • 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)

I'm strongly believing it's related to some background issue, otherwise, why it would display the picture using remote debug?

Thank you in advance,


share|improve this question

I'm just posting how I did to solve it in case someday someone needs a similar help...

In the end I tried a few steps that made my program work

  1. Not sure if necessary, but I executed the command line (according to monit manual) to make monit run on the foreground:

    /usr/bin/monit -Ic /etc/monit/monitrc
  2. I changed my script to set a display and to execute with my user. See how it's now:

    export DISPLAY=:0.0
    su -c "java -jar /home/thais/Desktop/MediaHandler_RC2.jar" thais
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.