Skip to main content

Relays – Make relays visible to all users

Applies to: Medulla Server
Version: Medulla 5.6.x
Environment: On-Premise / Debian 12 / MariaDB
Category: Administration / Relay management
Script: enable_relay_display.sh

This FAQ explains how to use the enable_relay_display.sh script to make Medulla relays visible to all users.

It outlines the various ways to use the script: one-time execution, automation, simulation, status checking, rolling back changes, and reactivation.

Note:
The script makes Medulla relays visible to all users by adding any missing global rules.
It does not modify the relay configuration or recreate rules that already exist.

Using sudo:
All commands requiring administrator privileges are shown with sudo.
The logged-in user must have the necessary permissions to execute these commands.


1. Prerequisites

Before using the script, verify the following:

  • Have a Medulla On-Premise server.
  • Use a compatible Debian environment, in particular Debian 12.
  • Have a compatible MariaDB server.
  • Have access to the Medulla databases.
  • Have the necessary administrator privileges.
  • Be able to run commands with sudo.

The script automatically performs several checks before modifying the configuration.

Caution:
Before running the script for the first time on a production server, it is recommended that you perform a backup of the Medulla databases.
For your first use, start in simulation mode.


2. Install the script

Download the script to the Medulla server

Log in to the Medulla server as a user with sudo privileges, then download the official script.

sudo wget -O /root/enable_relay_display.sh https://dl.medulla-tech.io/ma/enable_relay_display.sh

In the examples in this FAQ, the script is placed in the following directory:

/root/enable_relay_display.sh

Make the script executable

sudo chmod 700 /root/enable_relay_display.sh

Verify that it works

Verify that the file was successfully downloaded:

sudo ls -lh /root/enable_relay_display.sh

Check the script's syntax:

sudo bash -n /root/enable_relay_display.sh

Display the script's help:

sudo /root/enable_relay_display.sh --help

This command lists the various available functions.

Note:
One-time mode requires no additional installation.
The script can be run immediately after it has been downloaded and made executable.


3. What are the possible uses?

The script offers three main modes.

One-time execution

Makes existing relays visible immediately.

sudo /root/enable_relay_display.sh run

Automation with cron

Allows you to regularly check for the necessary rules, especially when new relays are added.

sudo /root/enable_relay_display.sh install-cron --interval 15

Automation with MariaDB

Allows you to perform checks automatically using the MariaDB event scheduler.

sudo /root/enable_relay_display.sh install-proc --interval 15

Recommendation:
For a standard Medulla installation, the install-cron mode with a 15-minute interval is an easy-to-manage solution.


4. Use the interactive menu

The script features an interactive menu that allows you to access the main functions without having to enter commands manually.

Open the menu

sudo /root/enable_relay_display.sh menu

You can also run the script directly:

sudo /root/enable_relay_display.sh

The menu allows you to:

  • Perform a one-time correction.
  • Perform a simulation.
  • Set up a cron job.
  • Set up a MariaDB automation.
  • Undo a previous operation.
  • Reactivate a suspended automation.
  • View the status of relays and automations.

Note:
The interactive menu is particularly useful when using the script for the first time.


5. Simulate changes before applying them

Before making changes, it is recommended that you run a simulation.

Run a simulation

sudo /root/enable_relay_display.sh run --dry-run

This command allows you to:

  • Check the prerequisites.
  • Identify existing relays.
  • Identify relays that require a global rule.
  • View the operations that would be performed.
  • Check the generated logs.

Simulation:
The --dry-run mode allows you to prepare and preview operations without applying changes to the Medulla rules.

Simulate a cron installation

sudo /root/enable_relay_display.sh install-cron --interval 15 --dry-run

Simulate a MariaDB installation

sudo /root/enable_relay_display.sh install-proc --interval 15 --dry-run

6. Make all relays visible immediately

To apply the missing rules to existing relays, use one-time mode.

Run the script

sudo /root/enable_relay_display.sh run

The script automatically performs the following operations:

  1. Checks the environment.
  2. Searches for existing relays.
  3. Identifies relays that require a global rule.
  4. Adds the missing rules.
  5. Records the execution result.
  6. Creates a file for undoing the changes.

Existing rules are not recreated.

Verify the result

sudo /root/enable_relay_display.sh status

Success:
When the execution completes successfully and no relay requires a new rule, the global rules being searched for are present for all existing relays.


7. Can the script be run multiple times?

Yes.

The script can be run multiple times without recreating rules that already exist.

To run a check again:

sudo /root/enable_relay_display.sh run

If all relays already have the necessary rules, no new rules are added.

This feature is particularly useful after adding new relays.


8. Automate relay visibility with cron

Cron mode allows you to automatically maintain the global rules for relays.

It is recommended when new relays may be added regularly to the Medulla infrastructure.

Set up automation every 15 minutes

sudo /root/enable_relay_display.sh install-cron --interval 15

The script sets up a scheduled task on the Debian server.

An initial run is performed during installation to process existing relays.

Location of the cron job

The task is installed in:

/etc/cron.d/medulla-relay-display

Check for the presence of the task

sudo cat /etc/cron.d/medulla-relay-display

Check the automation status

sudo /root/enable_relay_display.sh status

Note:
Once the automation is installed, new relays are processed during the next scheduled run.
It is normally no longer necessary to manually rerun the script.


9. What intervals can be used with cron?

Cron mode supports the following intervals:

  • 1 minute: --interval 1
  • 2 minutes: --interval 2
  • 3 minutes: --interval 3
  • 4 minutes: --interval 4
  • 5 minutes: --interval 5
  • 6 minutes: --interval 6
  • 10 minutes: --interval 10
  • 12 minutes: --interval 12
  • 15 minutes: --interval 15
  • 20 minutes: --interval 20
  • 30 minutes: --interval 30

The interval must be a divisor of exactly 60 minutes.

Example: check every 5 minutes

sudo /root/enable_relay_display.sh install-cron --interval 5

Example: check every 30 minutes

sudo /root/enable_relay_display.sh install-cron --interval 30

Caution:
An interval such as --interval 7 is not allowed in cron mode.
Use one of the permitted values.


10. Automate relay visibility with MariaDB

The script offers a second automation method that uses the MariaDB event scheduler directly.

This method allows you to maintain global rules without installing a cron job on Debian.

Install the MariaDB automation

sudo /root/enable_relay_display.sh install-proc --interval 15

This command configures the automation to check every 15 minutes.

An initial run is performed during installation.

Use a different interval

For example, to check every 30 minutes:

sudo /root/enable_relay_display.sh install-proc --interval 30

Verify the installation

sudo /root/enable_relay_display.sh status

Note:
The MariaDB automation requires that the server’s event scheduler be enabled.


11. Check the MariaDB scheduler

For MariaDB automation to work, the event scheduler must be enabled.

Check its status

sudo mysql -N -B -e "SELECT @@GLOBAL.event_scheduler;"

The expected result is:

ON

If the result is OFF, the scheduler is not active.

Temporarily enable the scheduler

If necessary, and after verifying the server configuration:

sudo mysql -e "SET GLOBAL event_scheduler = ON;"

This change may not be retained after a MariaDB restart.

To enable it permanently, adjust the server’s MariaDB configuration.

Caution:
Enabling the MariaDB scheduler may affect other events present on the server.
Verify its usage before modifying this setting.


12. Which automation method should you choose: cron or MariaDB?

Both methods allow you to automatically enforce global relay rules.

Choose cron if:

  • You want automation managed through Debian.
  • You already use cron for your system tasks.
  • You want to easily view the scheduled task.
  • You prefer a solution that’s easy to monitor.

Choose MariaDB if:

  • You prefer automation managed directly by the database.
  • The MariaDB event scheduler is already in use.
  • You do not want to add a system cron job.

Recommendation:
For a standard Medulla installation, we recommend the install-cron mode with a check every 15 minutes.


13. Can both automation methods be installed simultaneously?

No.

The script is designed to use only one automation method at a time.

You must choose:

  • Either the cron automation.
  • Or the MariaDB automation.

To switch methods, first uninstall the existing automation using its rollback file.

Then install the new automation.


14. Check the status of relays and automations

The script provides a command to check the configuration status.

Display the status

sudo /root/enable_relay_display.sh status

This command allows you to check the following:

  • Whether a cron automation exists.
  • Whether a MariaDB automation exists.
  • The status of the MariaDB scheduler.
  • Relays that do not yet have the global rule.
  • Whether there are any duplicates.
  • Available rollback files.

Best practice:
Run the status command after every installation, modification, or uninstallation.


15. What happens when a new relay is added?

The behavior depends on the mode used.

In one-time mode

The new relay will be taken into account during the next manual execution.

sudo /root/enable_relay_display.sh run

With automation

The new relay will automatically be taken into account during the next scheduled run.

No manual intervention is normally required.


16. View execution logs

The script stores information about its executions in a log directory.

By default, when the script is placed in /root/, this directory is:

/root/relay_display_logs/

View available files

sudo ls -lah /root/relay_display_logs/

View the cron log

sudo tail -n 100 /root/relay_display_logs/cron.log

Monitor cron executions in real time

sudo tail -f /root/relay_display_logs/cron.log

Search for the latest logs

sudo find /root/relay_display_logs/ -type f -name "*.log" -printf "%T@ %p\n" | sort -nr | head -20

Note:
The location of the logs can be customized using the LOG_DIR variable.


17. How do I undo a one-time run?

The script generates a rollback file that allows you to undo the changes made.

Search for rollback files

sudo find /root/relay_display_logs/ -name "*.rollback.sh"

Run the rollback

sudo /root/enable_relay_display.sh rollback /root/relay_display_logs/NAME.rollback.sh

Replace NAME.rollback.sh with the name of the file corresponding to the run you want to roll back.

The script performs the necessary checks before deleting the affected rules.

Caution:
It is important to use the rollback file corresponding to the run you wish to undo.
Do not manually delete the rules in MariaDB.


18. How do I uninstall the cron automation?

To remove the cron automation, use the rollback file created during its installation.

Identify the rollback file

sudo find /root/relay_display_logs/ -name "*.rollback.sh"

Run the uninstallation

sudo /root/enable_relay_display.sh rollback /root/relay_display_logs/NAME.rollback.sh

The script allows you to choose between two options:

  • Keep the rules: Remove the automation without deleting the rules that have already been added.
  • Delete the rules: Remove the automation and undo the changes it made, provided the rules have not been modified since then.

Verify the uninstallation

sudo /root/enable_relay_display.sh status

The cron job associated with this installation should no longer be active.


19. How do I uninstall the MariaDB automation?

Uninstalling the MariaDB automation also uses the rollback file created during its installation.

Identify the rollback file

sudo find /root/relay_display_logs/ -name "*.rollback.sh"

Run the uninstallation

sudo /root/enable_relay_display.sh rollback /root/relay_display_logs/NAME.rollback.sh

The script prompts you to keep or delete the rules added by the automation.

It then proceeds to uninstall the relevant MariaDB components.

Verify the uninstallation

sudo /root/enable_relay_display.sh status

Note:
The rollback verifies the installation’s identity before removing the associated components.
This prevents an older rollback file from deleting a more recent installation.


20. What happens if rules have been modified?

A rule added by the script may be modified later by an administrator or by another component.

In this case, the normal rollback protects the modified rules to prevent their accidental removal.

If changes are detected, the script may refuse to proceed with the removal of certain rules.

In this case, it is recommended that you:

  1. Review the message displayed by the script.
  2. Identify the affected rules.
  3. Check whether these changes should be retained.
  4. Resume the rollback based on the desired outcome.

Caution:
Do not manually delete a modified rule without first verifying its current usage in Medulla.


21. How do I perform a partial rollback?

When certain rules have been modified, the script allows you to continue the rollback while retaining those rules.

Rules that have not been modified can be deleted.

The modified rules remain in place.

The rollback file is retained in case further action is needed.

Note:
A partial rollback does not necessarily mean that the operation failed.
It may simply indicate that certain rules were retained to prevent the loss of subsequent changes.


22. How do I resume an interrupted rollback?

If a rollback is interrupted, you can restart it using the same file.

Restart the rollback

sudo /root/enable_relay_display.sh rollback /root/relay_display_logs/NAME.rollback.sh

The script takes into account the steps already completed and attempts to continue the operation.

Caution:
Do not delete the rollback files or status files until the operation is complete.


23. How do I reactivate a suspended automation?

An automation may be suspended following an interrupted rollback.

When its status allows it, you can reactivate it.

Reactivate the automation

sudo /root/enable_relay_display.sh reactivate

Check its status

sudo /root/enable_relay_display.sh status

Caution:
Reactivation is denied if the rollback has already begun deleting the rules.
In this situation, you must continue or complete the rollback.


24. How do I change the script’s language?

The script is available in three languages:

  • French.
  • English.
  • Spanish.

Use French

sudo /root/enable_relay_display.sh status --lang fr

Use English

sudo /root/enable_relay_display.sh status --lang en

Use Spanish

sudo /root/enable_relay_display.sh status --lang es

The --lang parameter can also be used with other commands.

Example:

sudo /root/enable_relay_display.sh run --dry-run --lang en

25. What should I do if the script displays an error?

If an error occurs, start by checking the message displayed in the terminal.

Possible causes include:

  • Insufficient permissions.
  • An unavailable MariaDB connection.
  • An incompatible database configuration.
  • An automation that is already installed.
  • An incorrect scheduling interval.
  • A previous operation is incomplete.
  • Another execution is in progress.

Perform an initial diagnosis

sudo /root/enable_relay_display.sh status

Check the logs

sudo ls -lah /root/relay_display_logs/

Next, review the log corresponding to the operation that failed.

Note:
If the script rejects an operation, do not bypass the security checks without first identifying the cause of the rejection.


26. Why does a relay remain invisible after execution?

The script adds the global rules necessary for relays to be visible.

It does not modify Medulla’s other operating parameters.

If a relay remains invisible:

  1. Verify that the script completed without errors.
  2. Run the status command.
  3. Refresh the Medulla interface.
  4. Check the permissions for the relevant user.
  5. Check the relay configuration.
  6. Check the Medulla logs if the problem persists.

Check the status

sudo /root/enable_relay_display.sh status

27. Can the script be moved or deleted after installation?

It is recommended that you keep the script in its original location as long as an automation is active.

In particular, cron mode uses the script path saved during installation.

If the file is moved or deleted, future automatic runs may fail.

Also keep the rollback files until the automation has been completely uninstalled.

Caution:
Do not delete the script or its log directory until you have uninstalled the automations and verified their status.


28. What steps should I follow for first-time use?

For first-time use on a Medulla server, we recommend the following procedure.

Step 1: Download the script

sudo wget -O /root/enable_relay_display.sh https://dl.medulla-tech.io/ma/enable_relay_display.sh
sudo chmod 700 /root/enable_relay_display.sh

Step 2: Check the environment

sudo /root/enable_relay_display.sh status

Step 3: Run a simulation

sudo /root/enable_relay_display.sh run --dry-run

Step 4: Apply any missing rules

sudo /root/enable_relay_display.sh run

Step 5: Verify the result

sudo /root/enable_relay_display.sh status

Step 6: Verify visibility in Medulla

Log in to the Medulla interface and verify that the expected relays are visible to the relevant users.

Step 7: Set up an automation if necessary

For an automation every 15 minutes:

sudo /root/enable_relay_display.sh install-cron --interval 15

Step 8: Verify the setup

sudo /root/enable_relay_display.sh status

Success:
Once the checks are satisfactory and the automation is active, new relays will be automatically processed during subsequent runs.


29. Summary of commands

Download the script

sudo wget -O /root/enable_relay_display.sh https://dl.medulla-tech.io/ma/enable_relay_display.sh

Make the script executable

sudo chmod 700 /root/enable_relay_display.sh

View help

sudo /root/enable_relay_display.sh --help

Open the interactive menu

sudo /root/enable_relay_display.sh menu

View status

sudo /root/enable_relay_display.sh status

Simulate an execution

sudo /root/enable_relay_display.sh run --dry-run

Run a one-time correction

sudo /root/enable_relay_display.sh run

Set up a cron job

sudo /root/enable_relay_display.sh install-cron --interval 15

Set up a MariaDB automation

sudo /root/enable_relay_display.sh install-proc --interval 15

Undo an operation

sudo /root/enable_relay_display.sh rollback /root/relay_display_logs/NAME.rollback.sh

Reactivate a suspended automation

sudo /root/enable_relay_display.sh reactivate

View messages in English

sudo /root/enable_relay_display.sh status --lang en

View logs

sudo ls -lah /root/relay_display_logs/
sudo tail -n 100 /root/relay_display_logs/cron.log

30. Recommendations

To get the most out of the script:

  • Back up your system before using it for the first time.
  • Use an account with sudo privileges.
  • Start with a simulation using the --dry-run option.
  • Check the results in the Medulla interface.
  • Use cron mode for simple automation.
  • Do not install both automations at the same time.
  • Keep the rollback files.
  • Do not move the script while an automation is using it.
  • Check the logs in case of an error.
  • Check the status regularly using the status command.

In summary:
To immediately make all relays visible, use sudo /root/enable_relay_display.sh run.
To automatically maintain their visibility, use install-cron or install-proc with sudo.
To verify the configuration, use sudo /root/enable_relay_display.sh status.
To undo an operation, use the corresponding rollback file.