How to check multiple condition in "If Failed port"

Issue #301 open
Arasu b created an issue

We want to run a bash script when any of 3 port failed. like below

if failed port 9001 or 9002 or 9003 type tcp then exec "/bin/bash -c 'script.sh'"

is this possible?

thanks arasu.b

Comments (8)

  1. Tildeslash repo owner

    You need to test each port separately:

    if failed port 9001 then exec "/bin/bash -c 'script.sh'"
    if failed port 9002 then exec "/bin/bash -c 'script.sh'"
    if failed port 9003 then exec "/bin/bash -c 'script.sh'"
    

    (note: the "type tcp" is default, so it's not necessary to use this option)

  2. Arasu b reporter

    Hi team,

    The issue in case of 2 ports failed, the same script will execute 2 times. Number of ports will increase to 10 from 3.

    Thanks arasu.b

  3. Arasu b reporter
    • changed status to open

    Hi team,

    The issue in case of 2 ports failed, the same script will execute 2 times. Number of ports will increase to 10 from 3.

    Thanks arasu.b

  4. Tildeslash repo owner

    Testing of multiple ports with one statement is not supported currently.

    It is true the script will be executed once for each failed port - if it is important to execute it only once, as a workaround the script can be modified to track the execution time and skip if it was executed recently.

  5. Arasu b reporter

    Thanks for taking up this enhancement, In the mean time i also will try to contribute to this feature.

    thanks arasu.b

  6. Log in to comment