sysadmin - Execution of python scripts like udev/rules.d, cron.d or /apt/source.d -
I use python for patch system settings of distributed Linux systems with partimage. I have to have the following Python script structure:
/patch.d/ 10_patch_netwok.py 20_patch_hostname.py ... 50_patch_software_xyz.py InitSystem.py
< Code> InitSytem.py should run Python scripts in the /patch.d
folder. After my idea: for file in the file
files = glob.glob ("patch.d / *. Py") files.sort (): execfile (file,. ..)
What is the suggestion to load the dragon script and run it with another dragon script?
Python scripts are also python modules, so the best way to load them is to run them. Import them using only >>
This means that they run in the same process, however, only
__ import __ ('some_module'). If it is undesirable, use multi-threading or multi-processing support in your options to prevent every interaction in each thread in a different thread / process in the dragon, or to call the system os.subprocess module Run the script to be used.
Comments
Post a Comment