Add pipe in program

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Add pipe in program

Oscar Segarra
Hi, 

I'd like to execute a pipe in the program check:

check program check-nfs-resources with path "showmount -e localhost |grep nfs_resource"
    with timeout 25 seconds
    depends on check-nfs-ganesha-service
    if status != 0 for 3 cycles then exec "/usr/sbin/service nfs-ganesha restart"
    if status != 0 within 60 cycles then unmonitor


But it looks the "|" is "deleted" from my command line. I've tried to scape it with "\" but It doesn't work either.

Is there any trick to be able to do this? 

Thanks a lot,


--
To unsubscribe:
https://lists.nongnu.org/mailman/listinfo/monit-general
Reply | Threaded
Open this post in threaded view
|

Re: Add pipe in program

Geoff Goas

Can you do bash -c 'command' ?


On Feb 23, 2017 4:16 PM, "Oscar Segarra" <[hidden email]> wrote:
Hi, 

I'd like to execute a pipe in the program check:

check program check-nfs-resources with path "showmount -e localhost |grep nfs_resource"
    with timeout 25 seconds
    depends on check-nfs-ganesha-service
    if status != 0 for 3 cycles then exec "/usr/sbin/service nfs-ganesha restart"
    if status != 0 within 60 cycles then unmonitor


But it looks the "|" is "deleted" from my command line. I've tried to scape it with "\" but It doesn't work either.

Is there any trick to be able to do this? 

Thanks a lot,


--
To unsubscribe:
https://lists.nongnu.org/mailman/listinfo/monit-general


--
To unsubscribe:
https://lists.nongnu.org/mailman/listinfo/monit-general
Reply | Threaded
Open this post in threaded view
|

Re: Add pipe in program

Eric Pailleau-3
In reply to this post by Oscar Segarra
Hi,

Write a script that does your command.
This is also better because you can set write permissions to this script to allowed people,
without the need to be root .
regards

Le 23/02/2017 22:16, Oscar Segarra a écrit :
Hi, 

I'd like to execute a pipe in the program check:

check program check-nfs-resources with path "showmount -e localhost |grep nfs_resource"
    with timeout 25 seconds
    depends on check-nfs-ganesha-service
    if status != 0 for 3 cycles then exec "/usr/sbin/service nfs-ganesha restart"
    if status != 0 within 60 cycles then unmonitor


But it looks the "|" is "deleted" from my command line. I've tried to scape it with "\" but It doesn't work either.

Is there any trick to be able to do this? 

Thanks a lot,



--
To unsubscribe:
https://lists.nongnu.org/mailman/listinfo/monit-general


--

--
To unsubscribe:
https://lists.nongnu.org/mailman/listinfo/monit-general
Reply | Threaded
Open this post in threaded view
|

Re: Add pipe in program

Oscar Segarra
Hi, 

@Geoff, with bash -c it has worked perfectly! 

Thanks a lot.



2017-02-24 9:42 GMT+01:00 Eric Pailleau <[hidden email]>:
Hi,

Write a script that does your command.
This is also better because you can set write permissions to this script to allowed people,
without the need to be root .
regards

Le 23/02/2017 22:16, Oscar Segarra a écrit :
Hi, 

I'd like to execute a pipe in the program check:

check program check-nfs-resources with path "showmount -e localhost |grep nfs_resource"
    with timeout 25 seconds
    depends on check-nfs-ganesha-service
    if status != 0 for 3 cycles then exec "/usr/sbin/service nfs-ganesha restart"
    if status != 0 within 60 cycles then unmonitor


But it looks the "|" is "deleted" from my command line. I've tried to scape it with "\" but It doesn't work either.

Is there any trick to be able to do this? 

Thanks a lot,



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