Custom service from configuration

Hi, I really like how VyOS works. It is based on a runtime configuration, right? I need VyOS + a Python script to run. The Python script doesn’t have anything with routing to do, it is a kind of small server.

Is it possible to tweak the OS so I can include the Python script in the configuration file? For example add new configuration parameters like PythonScriptIP and PythonScriptPort, so every time the VyOS’ runtime configuration is loaded, it will see the two parameters and then run them as arguments in the background: python3 script.py PythonScriptIP PythonScriptPort

Thanks in advance.

There are various ways you can run that after the initial install:

https://docs.vyos.io/en/latest/automation/index.html

I would probably solve this by running your custom stuff through /config/scripts/vyos-postconfig-bootup.script:

https://docs.vyos.io/en/latest/automation/command-scripting.html

You can also have your script running after each commit (and not only on boot):

https://docs.vyos.io/en/latest/automation/command-scripting.html#executing-pre-hooks-post-hooks-scripts

Build a container and run it in vyos?

1 Like