The idea is to implement a method where a user will be able to modify an xml file and the modifications will trigger a certain action in the script. This has to be implemented in python.
WatchDogs is a python library that helps in file system monitoring.
API reference: https://pythonhosted.org/watchdog/quickstart.html#quickstart
Useful link: http://brunorocha.org/python/watching-a-directory-for-file-changes-with-python.html
The example scripts provided in the above links give a good headstart to play around with the file system and figure what is the exact use case that you want to achieve.
Current use case:
The python script that I run is bundled as a container. There are mounted volumes in the container.
So using an external script I am planning to modify the xml file and since the same file is modified inside the container, the python thread that is listening to the file modification event will trigger an action like sending a mail, make an entry to the log file.
The sample scripts are working fine. Let's see how the idea of making it working inside the container works out.
Comments
Post a Comment