1.
http://stackoverflow.com/questions/1908610/how-to-get-pid-of-background-process

2. Try to get start/stop env/debug to a log file

3. Try to suid inside start/stop... take your "init" scripts as an example.

My 3 cents,
    Rui Lapa

On Wed, Jul 9, 2014 at 7:10 PM, Anthony Griffiths <[email protected]>
wrote:

> again, not being an expert, why not try just this to compare::
>
>
> *check process contego with pidfile /home/sms/vouchers/contego.pid
> start program = "/home/sms/vouchers/contego_start.sh    stop program =
> "/home/sms/vouchers/contego_stop.sh*
>
> also, what are the permissions on /home/sms/vouchers/contego.pid? is it
> writaable?
>
>
> On Wed, Jul 9, 2014 at 6:51 PM, Martin Vaner <[email protected]> wrote:
>
>>  Hi Anthony, hello all,
>>
>> the chmod of the file is 0755.
>> The output of the monit -vv:
>>
>>
>>
>>
>>
>>
>>
>>
>> *Process Name             = contego  Pid file                         =
>> /home/sms/vouchers/contego.pid  Monitoring mode      = active  Start
>> program            = '/home/sms/vouchers/contego_start.sh' as uid 1000 as
>> gid 1000 timeout 30 second(s)  Stop program             =
>> '/home/sms/vouchers/contego_stop.sh' as uid 1000 as gid 1000 timeout 30
>> second(s)  Existence                    = if does not exist 1 times within
>> 1 cycle(s) then restart else if succeeded 1 times within 1 cycle(s) then
>> alert  Pid                              = if changed 1 times within 1
>> cycle(s) then alert  Ppid                             = if changed 1 times
>> within 1 cycle(s) then alert*
>>
>> The problem with log is the monit says the same - Execution failed -
>> there. As you can see:
>>
>>
>>
>>
>> *[UTC Jul  9 17:45:21] error    : 'contego' process is not running [UTC
>> Jul  9 17:45:21] info     : 'contego' trying to restart [UTC Jul  9
>> 17:45:21] info     : 'contego' start: /home/sms/vouchers/contego_start.sh
>> [UTC Jul  9 17:45:51] error    : 'contego' failed to start*
>>
>> It is very interresting.
>>
>>
>> On 9. 7. 2014 19:39, Anthony Griffiths wrote:
>>
>> hi I'm no expert on this but I use:
>> # chmod 755 /path/to/script.sh
>> also, when it says 'Execution failed' are you getting this in the console
>> or in monit.log?. Have you tried running monit in debig mode? (it shows a
>> lot more detail)
>> eg: #monit -vv
>>
>>
>> On Wed, Jul 9, 2014 at 6:04 PM, Martin Vaner <[email protected]> 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
>>>
>>
>>
>>
>> --
>> To unsubscribe:https://lists.nongnu.org/mailman/listinfo/monit-general
>>
>>
>>
>> --
>> To unsubscribe:
>> https://lists.nongnu.org/mailman/listinfo/monit-general
>>
>
>
> --
> To unsubscribe:
> https://lists.nongnu.org/mailman/listinfo/monit-general
>
--
To unsubscribe:
https://lists.nongnu.org/mailman/listinfo/monit-general

Reply via email to