Lance

Documentation

Requirement:

1. python-ssl

2. python-ldap (for manager with ldap accounts

3. python-ldap

Lance/Lance_manager Installation

1. Create the main /etc/lance.conf file (refer to the example lance.conf)

2. Create the /etc/lance.d directory to store your configuration files

3. Create all your conf files in /etc/lance.d (all *.conf files in this directory will be read)

4. Copy lance.py, lance_manager.py, lc.py and the three directories lance, lance_common and lance_manager somewhere in your path

5. Ensure the lance, lance_manager, lance_common directories are in the same directory as lance.py and lance_manager.py

Lance_manager Installation

1. Create the main /etc/lance_manager.conf file (refer to the example lance_manager.conf)

2. Create the /etc/lance.d/remote directory to store your remote configuration files (the .conf files matching hostname that connect to lance_manager)

3. Copy lance_manager.py somewhere in your path

Starting Lance

run lance.py # start lance foreground (will refuse to start if it's already running)

run lance.py -s # start the daemon (will refuse to start if it's already running)

run lance.py -d # start the daemon in debug mode (output errors... on foreground)

run lance.py -r # review your config file and ensure everything is correct (note that if lance is running with the statefull mode you will be able to see the actual states of running processes...

/etc/init.d/lance start # Start lance if init.d script deployed

/etc/init.d/lance restart # Stop and Start lance if init.d script deployed

Starting Lance_manager

run lance_manager.py # start lance foreground

run lance_manager.py -s # start lance manager as daemon

run lance_manager.py -d # start lance manager as daemon in debug mode (output errors... on foreground)

run lance_manager.py -r # review your config file and ensure everything is correct

LOGS

Lance will output log to standard output if 'log=' option is not set in lance.conf

however, lance is able to talk to syslog directly (default on localhost UDP port 514 (usual syslog port) on local2)

This can be specified in lance.conf

Management via CLI

lc.py --status # list the current processes and their status

lc.py --stop processnamei # stop launching the process specified by processname

lc.py --start processname # resume launching the process specified by processname

lc.py --run processname # immediatly run the process specified by processname. This command reenable the process if it was disabled

lc.py --kill processname # immediatly kill the process specified by processname.

lc.py --pause # pause the daemon (will wait for all running processes to finish)

lc.py --unpause # unpause the daemon (processes that were disabled with the "stop" command still be disabled)

Stopping LANCE

killall lance.py # shutdown the daemon (will wait for all running processes to finish)

/etc/init.d/lance stop # Stop lance if init.d script deployed

Reloading all configuration files

killall -HUP lance.py

/etc/init.d/lance reload # Reload configuration files (without stopping lance) if lance init.d script is installed

Printing current lance state to the logs

killall -SIGUSR1 lance.py

Configuring lance.conf

See sample configs provided for information and usage

Lance.d/*.conf files

[name] # (MANDATORY) The name of the process

command=mycommand # (MANDATORY) The command to execute

user=testuser # (OPTIONAL) The user to run the command as (must be a local user)

sleep=x seconds # (OPTIONAL) Number of seconds to sleep between each execution of the process

before=name # (OPTIONAL) This process will be executed before the command defined as name (the other one is locked until this one finish)

time=HH:MM:SS # (OPTIONAL) Command is run only at time HH:MM:SS

precheck=precheckcommand # (OPTIONAL) Execute precheckcommand, only if the return code is 0 (success), the command is executed

Lance_manager.conf files

See sample configs provided for information and usage