]> git.ipfire.org Git - people/stevee/guardian.git/log
people/stevee/guardian.git
8 years agoDrop function for fileposition initialization.
Stefan Schantl [Wed, 25 Nov 2015 08:06:46 +0000 (09:06 +0100)] 
Drop function for fileposition initialization.

This function has been moved to the "Base" module.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
8 years agoIntroduce "Base" module
Stefan Schantl [Wed, 25 Nov 2015 08:04:55 +0000 (09:04 +0100)] 
Introduce "Base" module

This module just contains some basic functions of guardian.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
8 years agoAllow to dynamically start/stop worker threads.
Stefan Schantl [Tue, 24 Nov 2015 13:09:09 +0000 (14:09 +0100)] 
Allow to dynamically start/stop worker threads.

All worker threads now dynamically can be started or stopped by calling the
responsible functions (StartWorkers, StopWorkers).

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
8 years agoEnable and use the warnings core module.
Stefan Schantl [Tue, 24 Nov 2015 12:26:34 +0000 (13:26 +0100)] 
Enable and use the warnings core module.

When using the warnings module, perl will display a lot
of usefull informations when launching the script and
therefore helps to improve the code.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
8 years agoUse TimeHires core module for main loop interupting.
Stefan Schantl [Tue, 24 Nov 2015 12:20:41 +0000 (13:20 +0100)] 
Use TimeHires core module for main loop interupting.

Using the TimeHires module and interupting the main loop for
10 miliseconds will reduce the cpu load of guardian to almost
zero instead of burning it.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
8 years agoCapture process signals.
Stefan Schantl [Mon, 23 Nov 2015 09:34:55 +0000 (10:34 +0100)] 
Capture process signals.

guardian now captures sent process siganls and can perform
various actions based on the captured signal. Currently only
"INT", "TERM", and "QUIT" signals are handeled. Some other
may be added in the future.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
8 years agoSocket.pm: Add tiny subroutine to drop an existing socket file.
Stefan Schantl [Mon, 23 Nov 2015 09:31:52 +0000 (10:31 +0100)] 
Socket.pm: Add tiny subroutine to drop an existing socket file.

This function can be called at any time to release the socket file.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
8 years agoSocket.pm: Fix error messages when crashing.
Stefan Schantl [Mon, 23 Nov 2015 09:24:52 +0000 (10:24 +0100)] 
Socket.pm: Fix error messages when crashing.

When the module crashed (died) for some reasons, the provided details where
empty.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
8 years agoSocket.pm: Fix detection and deletion of an existing socket file.
Stefan Schantl [Mon, 23 Nov 2015 09:23:55 +0000 (10:23 +0100)] 
Socket.pm: Fix detection and deletion of an existing socket file.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
8 years agoAdd support for command line arguments and usage of "Config" module.
Stefan Schantl [Mon, 23 Nov 2015 08:57:25 +0000 (09:57 +0100)] 
Add support for command line arguments and usage of "Config" module.

guardian now can be called with some additional command line arguments, like
"--config" to specify a different config file than the default one. The optoions
"--help" and "--vesion" will display some help texts and version informations on
the console. The "--foreground" option is not supported/implemented yet and will
be used to keep the process in the foreground and not fork into background at a later
time.

The "Config" module now also is used to get all settings from the config file and
store them into a hash called mainsettings for a later usage.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
8 years agoUse socket module to provide an IPC mechanism.
Stefan Schantl [Fri, 20 Nov 2015 21:56:02 +0000 (22:56 +0100)] 
Use socket module to provide an IPC mechanism.

Guardian now supports inter-process-communication based on
an UNIX socket, which is based on the guardians socket module.

All recieved messages via socket automatically will be accepted
and parsed. If they are valid, the corresponding events will be
enqueued into the main event queue of guardian.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
8 years agoAdd "Socket" module.
Stefan Schantl [Fri, 20 Nov 2015 21:37:29 +0000 (22:37 +0100)] 
Add "Socket" module.

The Socket module provides an IPC mechanism for guardian, based
on a UNIX socket. It contains a server, a client and a message parser
function which easily can be re-used.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
8 years agoAdd "Config" module.
Stefan Schantl [Fri, 20 Nov 2015 20:56:49 +0000 (21:56 +0100)] 
Add "Config" module.

This module contains functions to read, validate and set various
configure options which are used in guardian.

The main functions called "UseConfig" allows to pass which config file
should be read and validates the input by calling a subfunction. The
validated settings will be returend as a hash.

The "CheckConfig" function directly can be called with a hash, which
contains the various config options and values and will return an
error message if there are any problems.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
8 years agoAdd "Logger" module.
Stefan Schantl [Fri, 20 Nov 2015 14:23:56 +0000 (15:23 +0100)] 
Add "Logger" module.

This module is responsible for logging any messages which are generated by
guaridan or one of its submodules during runtime and displays them on the
console or send them to the syslog.

When using the logger module, it has to be initialized as an object, which calls the
"New" function and requires the following settings:

* LogLevel - which has to be "off, err, info or debug"
* LogFacility - which currently supports "console or syslog"

After that, logging can be done, by using the "Log" function on the object, by providing
the type of the message (LogLevel) and the message self.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
8 years agoInitial checkin.
Stefan Schantl [Thu, 12 Nov 2015 22:07:44 +0000 (23:07 +0100)] 
Initial checkin.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>