57.3. Module Configuration Settings

This module demonstrates how the various Cron file locations, formats, and programs on different operating systems can be supported by the same code. If you look in its directory, you will see numerous files with names starting with config-, such as config-solaris and config-redhat-linux. Each specifies the files to read and commands to use for particular operating systems. The code in cron-lib.pl makes numerous references to %config when listing and updating jobs, which, of course, is filled with the contents of /etc/webmin/cron/config. This file, in turn, comes from the appropriate config- file in the module's directory, chosen at the time Webmin was installed.

If your module manages some service that differs slightly between operating systems, this method of using different default configurations makes sense. It can also be useful when writing a module for some server like Apache because the default configuration and program file paths will differ depending on the operating system or Linux distribution due to the vast number of different Apache packages out there.

The config.info file in this module defines inputs for editing both the operating system dependent options in the configuration file and those related only to the module's user interface. Sometimes it makes very little sense to let users edit such settings as the location of users' personal Cron job files as they are pretty much determined by the operating system in use. For this reason, you might think that taking those fields out of config.info is a good idea so that users cannot mess up the module's configuration.

This will work fine, as it is really the entries in the appropriate config- file that get (indirectly) loaded into the %config hash. The config.info file just controls which ones are editable and what values are allowed—any others will be left unchanged when the user clicks on Module Config. In the Scheduled Cron Jobs module, however, all configuration settings can be edited, just in case the user upgrades the version of Cron that comes with his operating system to a totally different package.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
52.15.57.52