[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Execution failed
From: |
Martin Pala |
Subject: |
Re: Execution failed |
Date: |
Thu, 10 Jul 2014 09:49:09 +0200 |
Hi,
Monit <= 5.7 purges the environment variables and sets only spartan
PATH="/bin:/usr/bin:/sbin:/usr/sbin" + set of MONIT_* variables (documented in
the manual) ... this was done to run the program in a sandbox and not pass any
extra informations from parent process environment to child, but caused
problems in some cases, where the script depends on environment settings.
For example your script doesn't use absolute paths ... if "java" is not in the
above mentioned PATH, then it won't be found.
=> Monit upgrade to 5.8 or later should fix it ... alternatively you can load
the environment in the script or define required environment variables and/or
use absolute path.
Regards,
Martin
On 09 Jul 2014, at 19:04, Martin Vaner <address@hidden> wrote:
> Hi there.
> I just have a little problem. Monit does not want to start my bash script,
> and i do not know why, monit is saying only "Execution failed" so i cant
> identify what is causing my problem.
>
> Information about script:
>
> #!/bin/bash
> if [ -f /home/sms/vouchers/contego.pid ]
> then
> echo 'process already running'
> else
> java -Xmx1024m -jar jacon2.jar &
> pid_number=`ps -e -o pid,command | grep "jacon2.jar" | grep -v "\<grep\>"`
> touch contego.pid
> echo $pid_number > contego.pid
> fi
>
> File permissions:
> -rwxr-xr-x 1 sms sms 256 Jul 9 16:46 contego_start.sh
>
> Monit config file:
> check process contego with pidfile /home/sms/vouchers/contego.pid
> start program = "/home/sms/vouchers/contego_start.sh"
> as uid "sms" and gid "sms"
> stop program = "/home/sms/vouchers/contego_stop.sh"
> as uid "sms" and with gid "sms"
>
> When i run my script directly from console, the script is working without any
> issues.
> This is another problem what i have encountered before.
>
> Thank you for tips.
>
> Regards, Martin
> --
> To unsubscribe:
> https://lists.nongnu.org/mailman/listinfo/monit-general