monit-general
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Run two actions if a condition is met?


From: Martin Pala
Subject: Re: Run two actions if a condition is met?
Date: Tue, 18 Dec 2012 16:17:02 +0100

Hi,

multiple actions are not supported currently, you can use the following 
workaround:

--8<--
  if does not exist for 1 cycles then exec "/bin/bash -c 'any_command; 
/usr/bin/monit restart myservice'"
--8<--

Regards,
Martin


On Dec 18, 2012, at 3:36 PM, David Notivol <address@hidden> wrote:

> Hi all,
> 
> I'm not sure if it's possible to run two actions if a condition is met. My 
> idea was to restart the service and run an external command, but I'm not able 
> to configure it to work.
> 
> I don't know if it exists something like:
>   if does not exist then restart and exec "any_command"
> 
> I'm trying to launch it in two lines, but it only runs the last one:
>   if does not exist for 1 cycles then exec "any_command"
>   if does not exist for 1 cycles then restart
> 
> I know one simple solution would be to write a silly script that includes 
> both the restart of the service and the external command, but it'd be easier 
> if it's already made in monit. Do you know if is there any way to do it 
> directly in monit?
> 
> [ Sorry if it's in the docs or wiki, but I couldn't find it (I'm a new user 
> of monit). ]
> Thanks in advance.
> 
> -- 
> Regards,
> David Notivol
> 
> --
> To unsubscribe:
> https://lists.nongnu.org/mailman/listinfo/monit-general




reply via email to

[Prev in Thread] Current Thread [Next in Thread]