This C daemon was developed to aid management of your services. It's responsible for starting appropriate modules, each performing specific task. You have to select modules that you intend to use before starting the daemon. Each module makes configuration files based on its template and data from LMS database and manages (restarting) selected services on a server.
Why such name? The majority of daemon code has been written by one of developers - Aleksander 'A.L.E.C' Machniak. Nevertheless we must emphasize contributions done by Marcin 'Lexx' Krol. It also includes fragments of code of Mateusz 'mteg' Golicz old daemon and use Nicolas Devillard iniparser library.
A.L.E.C's LMS Daemon requires:
LMS user interface installation
libmysqlclient shared library (included in full MySQL installation or respective "devel" package) or libpq shared library in case of PostgreSQL database use or sqlite shared library
libdl shared library (present in every modern distribution)
C compiler (gcc)
You have to setup some configure options prior to compilation, that can be listed with --help flag of ./configure script (default values shown in brackets):
--help help --enable-debug0 SQL queries logging (disabled) --enable-debug1 events logging (disabled) --with-pgsql enables using of PostgreSQL database (disabled) --with-mysql enables using of MySQL database (enabled) --with-sqlite enables using of SQLite database (disabled) --prefix=DIR program install directory (/usr/local/bin) --libdir=DIR location of database libraries (/usr/lib) --incdir=DIR location of database header files (/usr/include)It's required to choose one database which you will use (--with-mysql or --with-pgsql or --with-sqlite) and location of libraries supplied with database (--incdir, --libdir). You can use only one database. If you will change database, you have to recompile your daemon.
# ./configure --with-pgsql --libdir=/usr/local/pgsql/lib --incdir=/usr/local/pgsql/includeAfter that you can compile and install (put daemon in directory given with --prefix option):
# make && make installFinally, compiled modules (files with .so extension), found in directory modules/module_name should be moved to some directory. Their location will be set in configuration file.
You can find example daemon configuration in lms.ini.sample file. The following listing describes basic options for the daemon (modules configuration is described later, in separate chapters concerning each module):
[database] host = localhost # host name or IP, default: localhost user = lms # user name, default: lms password = mypasswd # database password, default: empty database = lms # database name, default: lms port = 0 # port number, default: 0 [lmsd] sleeptime = 30 # time interval (in seconds) how often to # check for reload order, default: 30 instances = hosts oident firewall # selected (active) modules list command = 'echo Connecting...' # shell command that run before each database connection
![]() | List of instances contains modules names separated with spaces. Instance is a name of section below in this configuration file. |
Instance section, beside config modules params, must contain primary options, as on following listing:
[instance_name] module = /path/to/module.so info = "Additional description of module"
Change of 'instances' or any option in instance sections do not require daemon restart. For other global options restart is required.
You can run this program as a daemon, detached to background with option '-b'. While running configuration and services reload is performed on demand using 'Reload' menu in LMS-UI. Sleep time runtime option (-s) specify interval between database checks. When daemon detects reload order, it runs modules defined by 'instances' option in lms.ini. For example:
# almsd -b
Other way to run is periodical execution with cron. You have to use this mode for running modules like 'payments' 'notify' or 'traffic'. In those cases you can specify instances to reload with use of option '-i'. Example crontab entry:
1 0 * * * /usr/local/bin/almsd -qi "payments notify"
Following listing describes all program command line options:
-c path to config (default: /etc/lms/lms.ini) -i list of instances (separated by spaces) to reload -b run in background (daemon mode) -s database checks interval in sec. (default: 30) -q reload and quit -h prints command line options