Wrapper for CLI commands

Colleagues, I apologize if I ask quite absurd question, but still…

Is it possible, using standard tools, without interfering with the Astreisk sources, to set a function that, when some console commands were submitted, (for example, “core reload”) performed some additional actions? For example, a script in some supported interpreting language - Shell, Perl, Python, Lua.

I will explain why I am asking this question. If I use several parallel Asterisks, then the recommended righteous way to synchronize their configurations is to transfer the configs to an external database. At the same time, the execution of almost every line of the dialplan is accompanied by calls to this database.
I’m not even talking about the inconvenience of changing the configuration. With a large number of processed calls, a very large load falls on the base.
Maybe it’s easier to sync all changed config files, (for example using rsync), and relay critical console commands, (for example “reload”) ? Of course, this can be done from an external program, but from the console of the master-machine it is more convenient…

Thanks in advance for the answers to my question,
Ogogon.

My workflow is very close to Option B.

  1. I issue a command (‘make rsync-config’) that rsync’s the configuration files from my dev box to each of the production hosts.
  2. When convenient, from my dev box I issue a command (‘make remote-config’) that:
    2a. Issues a command to each host (‘make config’) to pass the configurations file through a pre-processor to customize the files for that host.
    2b. The configuration files are reloaded.