diff --git a/alignak/bin/alignak_environment.py b/alignak/bin/alignak_environment.py
new file mode 100755
index 000000000..64f864baa
--- /dev/null
+++ b/alignak/bin/alignak_environment.py
@@ -0,0 +1,212 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+# Copyright (C) 2015-2016: Alignak team, see AUTHORS.txt file for contributors
+#
+# This file is part of Alignak.
+#
+# Alignak is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# Alignak is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with Alignak. If not, see .
+
+"""
+set_alignak_env command line interface::
+
+ Usage:
+ set_alignak_env [-h]
+ set_alignak_env [-v]
+
+ Options:
+ -h, --help Show this usage screen.
+ -v, --verbose Run in verbose mode (print information on the console output)
+
+ Output:
+ This script will parse the provided configuration file and it will output all the
+ variables defined in this file as Linux/Unix shell export variables.
+
+ As an example for a file containing:
+ [DEFAULT]
+ BIN=../alignak/bin
+ ETC=.
+ VAR=/tmp/alignak
+ RUN=/tmp/alignak
+ LOG=/tmp/alignak
+
+ [alignak-configuration]
+ # Alignak main configuration file
+ CFG=%(ETC)s/alignak.cfg
+ # Alignak secondary configuration file (none as a default)
+ SPECIFICCFG=
+
+ [broker-master]
+ ### BROKER PART ###
+ CFG=%(ETC)s/daemons/brokerd.ini
+ DAEMON=%(BIN)s/alignak-broker
+ PID=%(RUN)s/brokerd.pid
+ DEBUGFILE=%(LOG)s/broker-debug.log
+
+ The script will output:
+ export ALIGNAK_CONFIGURATION_BIN=../alignak/bin;
+ export ALIGNAK_CONFIGURATION_ETC=.;
+ export ALIGNAK_CONFIGURATION_VAR=/tmp/alignak;
+ export ALIGNAK_CONFIGURATION_RUN=/tmp/alignak;
+ export ALIGNAK_CONFIGURATION_LOG=/tmp/alignak;
+ export ALIGNAK_CONFIGURATION_CFG=./alignak.cfg;
+ export ALIGNAK_CONFIGURATION_SPECIFICCFG='';
+ export BROKER_MASTER_BIN=../alignak/bin;
+ export BROKER_MASTER_ETC=.;
+ export BROKER_MASTER_VAR=/tmp/alignak;
+ export BROKER_MASTER_RUN=/tmp/alignak;
+ export BROKER_MASTER_LOG=/tmp/alignak;
+ export BROKER_MASTER_CFG=./daemons/brokerd.ini;
+ export BROKER_MASTER_DAEMON=../alignak/bin/alignak-broker;
+ export BROKER_MASTER_PID=/tmp/alignak/brokerd.pid;
+ export BROKER_MASTER_DEBUGFILE=/tmp/alignak/broker-debug.log;
+
+ The export directives consider that shell variables must only contain [A-Za-z0-9_]
+ in their name. All non alphanumeric characters are replaced with an underscore.
+ The value of the variables is quoted to be shell-valid: escaped quotes, empty strings,...
+
+ NOTE: this script manages the full Ini file format used by the Python ConfigParser:
+ default section, variables interpolation
+
+ Use cases:
+ Displays this usage screen
+ set_alignak_env (-h | --help)
+
+ Parse Alignak configuration files and define environment variables
+ cfg_file ../etc/alignak.ini
+
+ Parse Alignak configuration files and define environment variables and print information
+ cfg_file -v ../etc/alignak.ini
+
+ Exit code:
+ 0 if required operation succeeded
+ 1 if the required file does not exist
+ 2 if the required file is not correctly formatted
+ 3 if interpolation variables are not correctly declared/used in the configuration file
+
+ 64 if command line parameters are not used correctly
+"""
+from __future__ import print_function
+
+import os
+import sys
+import re
+
+from pipes import quote as cmd_quote
+
+import ConfigParser
+
+from docopt import docopt, DocoptExit
+
+from alignak.version import VERSION as __version__
+
+
+class AlignakConfigParser(object):
+ """
+ Class to parse the Alignak main configuration file
+ """
+
+ def __init__(self):
+ # Get command line parameters
+ args = None
+ try:
+ args = docopt(__doc__)
+ except DocoptExit as exp:
+ print("Command line parsing error:\n%s." % (exp))
+ exit(64)
+
+ # Alignak version as a property
+ self.alignak_version = __version__
+
+ # Print export commands for calling shell
+ self.export = True
+
+ # Verbose
+ self.verbose = False
+ if '--verbose' in args and args['--verbose']:
+ print("Verbose mode is On")
+ self.verbose = True
+
+ # Get the targeted item
+ self.configuration_file = args['']
+ if self.verbose:
+ print("Configuration file name: %s" % self.configuration_file)
+ if self.configuration_file is None:
+ print("Missing configuration file name. Please provide a configuration "
+ "file name in the command line parameters")
+ exit(64)
+ self.configuration_file = os.path.abspath(self.configuration_file)
+ if not os.path.exists(self.configuration_file):
+ print("Required configuration file does not exist: %s" % self.configuration_file)
+ exit(1)
+
+ def parse(self):
+ """
+ Parse the Alignak configuration file
+
+ Exit the script if some errors are encountered.
+
+ :return: None
+ """
+ config = ConfigParser.ConfigParser()
+ config.read(self.configuration_file)
+ if config._sections == {}:
+ print("Bad formatted configuration file: %s " % self.configuration_file)
+ sys.exit(2)
+
+ try:
+ for section in config.sections():
+ if self.verbose:
+ print("Section: %s" % section)
+ for (key, value) in config.items(section):
+ inner_property = "%s.%s" % (section, key)
+
+ # Set object property
+ setattr(self, inner_property, value)
+
+ # Set environment variable
+ os.environ[inner_property] = value
+
+ if self.verbose:
+ print(" %s = %s" % (inner_property, value))
+
+ if self.export:
+ # Allowed shell variables may only contain: [a-zA-z0-9_]
+ inner_property = re.sub('[^0-9a-zA-Z]+', '_', inner_property)
+ inner_property = inner_property.upper()
+ print("export %s=%s" % (inner_property, cmd_quote(value)))
+ except ConfigParser.InterpolationMissingOptionError as err:
+ err = str(err)
+ wrong_variable = err.split('\n')[3].split(':')[1].strip()
+ print("Incorrect or missing variable '%s' in config file : %s" %
+ (wrong_variable, self.configuration_file))
+ sys.exit(3)
+
+ if self.verbose:
+ print("Configuration file parsed correctly")
+
+
+def main():
+ """
+ Main function
+ """
+ parsed_configuration = AlignakConfigParser()
+ parsed_configuration.parse()
+
+ if parsed_configuration.export:
+ # Export Alignak version
+ print("export ALIGNAK_VERSION=%s" % (parsed_configuration.alignak_version))
+
+if __name__ == '__main__':
+ main()
diff --git a/alignak/daemon.py b/alignak/daemon.py
index b0973d527..ec27af95b 100644
--- a/alignak/daemon.py
+++ b/alignak/daemon.py
@@ -173,6 +173,10 @@ class Daemon(object):
# as returned once the daemon is started.
'workdir':
PathProp(default=DEFAULT_WORK_DIR),
+ 'logdir':
+ PathProp(default=DEFAULT_WORK_DIR),
+ 'etcdir':
+ PathProp(default=DEFAULT_WORK_DIR),
'host':
StringProp(default='0.0.0.0'),
'user':
diff --git a/bin/default/.gitignore b/bin/default/.gitignore
deleted file mode 100644
index 8775ec238..000000000
--- a/bin/default/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-alignak
diff --git a/bin/default/alignak.in b/bin/default/alignak.in
deleted file mode 100755
index ad145c010..000000000
--- a/bin/default/alignak.in
+++ /dev/null
@@ -1,165 +0,0 @@
-# Copyright (C) 2015-2016: Alignak team, see AUTHORS.txt file for contributors
-#
-# This file is part of Alignak.
-#
-# Alignak is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# Alignak is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with Alignak. If not, see .
-#
-#
-# This file incorporates work covered by the following copyright and
-# permission notice:
-#
-# Copyright (C) 2009-2014:
-# Gabes Jean, naparuba@gmail.com
-# Gerhard Lausser, Gerhard.Lausser@consol.de
-# Gregory Starck, g.starck@gmail.com
-# Hartmut Goebel, h.goebel@goebel-consult.de
-#
-# This file is part of Shinken.
-#
-# Shinken is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# Shinken is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with Shinken. If not, see .
-
-
-# /etc/default/alignak
-# $ETC$ is where we put all configuration files
-# $VAR$ is where we put some variables files (replaced by $RUN$ and $LOG$ for now)
-# $RUN$ is where we put pid files
-# $LOG$ is where we put log files
-# $LIB$ is where we put plugins files
-# $SCRIPTS_BIN$ is where the launch scripts will be send
-
-
-## These vars will override the hardcoded ones in init script ##
-ETC=$ETC$
-VAR=$VAR$
-BIN=$SCRIPTS_BIN$
-RUN=$RUN$
-LOG=$LOG$
-LIB=$LIB$
-
-
-### ARBITER PART ###
-# location of the arbiter daemon configuration
-ARBITERCFG="$ETC/daemons/arbiterd.ini"
-
-# location of the alignak configuration file
-# Now look if some required variables are pre defined:
-if [ -z "$ALIGNAKCFG" ]; then
- # Please update $ETC$ instead of this one.
- ALIGNAKCFG="$ETC/alignak.cfg"
-fi
-echo "Alignak main configuration file is: $ALIGNAKCFG"
-echo "---"
-
-# We got 2 configs because tools like Centreon don't generate all
-# configuration (only the alignak.cfg part)
-#ALIGNAKSPECIFICCFG="$ETC/alignak-specific.cfg"
-
-# The command to launch
-ARBITERDAEMON="$BIN/alignak-arbiter"
-
-#The ARBITER PID
-if [ -r "$ALIGNAKCFG" ]; then
- tmppid=`grep 'lock_file=' "$ALIGNAKCFG" | grep -v '#' | tail -n 1 | awk -F '=' '{print $2}'`
- ARBITERPID="${tmppid-$RUN/arbiterd.pid}"
-else
- ARBITERPID="$RUN/arbiterd.pid"
-fi
-
-ARBITERDEBUGFILE="$LOG/arbiter-debug.log"
-
-
-### SCHEDULER PART ###
-# location of the scheduler daemon configuration
-SCHEDULERCFG="$ETC/daemons/schedulerd.ini"
-
-# The command to launch
-SCHEDULERDAEMON="$BIN/alignak-scheduler"
-
-# The SCHEDULER PID
-SCHEDULERPID="$RUN/schedulerd.pid"
-
-SCHEDULERDEBUGFILE="$LOG/scheduler-debug.log"
-
-
-### POLLER PART ###
-# location of the poller daemon configuration
-POLLERCFG="$ETC/daemons/pollerd.ini"
-
-# The command to launch
-POLLERDAEMON="$BIN/alignak-poller"
-
-# The poller pid
-POLLERPID="$RUN/pollerd.pid"
-
-POLLERDEBUGFILE="$LOG/poller-debug.log"
-
-
-### REACTIONNER PART ###
-# location of the reactionner daemon configuration
-REACTIONNERCFG="$ETC/daemons/reactionnerd.ini"
-
-# The command to launch
-REACTIONNERDAEMON="$BIN/alignak-reactionner"
-
-#The reactionner pid
-REACTIONNERPID="$RUN/reactionnerd.pid"
-
-REACTIONNERDEBUGFILE="$LOG/reactionner-debug.log"
-
-
-### BROKER PART ###
-# location of the broker daemon configuration
-BROKERCFG="$ETC/daemons/brokerd.ini"
-
-# The command to launch
-BROKERDAEMON="$BIN/alignak-broker"
-
-# The broker pid
-BROKERPID="$RUN/brokerd.pid"
-
-BROKERDEBUGFILE="$LOG/broker-debug.log"
-
-
-### RECEIVER PART ###
-# location of the broker receiver configuration
-RECEIVERCFG="$ETC/daemons/receiverd.ini"
-
-# The command to launch
-RECEIVERDAEMON="$BIN/alignak-receiver"
-
-#The receiver pid
-RECEIVERPID="$RUN/receiverd.pid"
-
-RECEIVERDEBUGFILE="$LOG/receiver-debug.log"
-
-
-
-# nicelevel to run alignak daemon with
-NICENESS=5
-
-# user/group for the var/run rights
-#ALIGNAKUSER=alignak
-#ALIGNAKGROUP=alignak
-#HOME=`getent passwd "$ALIGNAKUSER" | cut -d: -f 6`
diff --git a/bin/init.d/alignak b/bin/init.d/alignak
deleted file mode 100755
index f964aa240..000000000
--- a/bin/init.d/alignak
+++ /dev/null
@@ -1,558 +0,0 @@
-#!/bin/sh
-#
-# Copyright (C) 2015-2016: Alignak team, see AUTHORS.txt file for contributors
-#
-# This file is part of Alignak.
-#
-# Alignak is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# Alignak is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with Alignak. If not, see .
-#
-#
-# This file incorporates work covered by the following copyright and
-# permission notice:
-#
-# Copyright (C) 2009-2014:
-# Gabes Jean, naparuba@gmail.com
-# Gerhard Lausser, Gerhard.Lausser@consol.de
-# Gregory Starck, g.starck@gmail.com
-# Hartmut Goebel, h.goebel@goebel-consult.de
-#
-# This file is part of Shinken.
-#
-# Shinken is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# Shinken is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with Shinken. If not, see .
-
-### BEGIN INIT INFO
-# Provides: alignak
-# Required-Start: $network $remote_fs
-# Required-Stop: $network $remote_fs
-# Default-Start: 2 3 4 5
-# Default-Stop: 0 1 6
-# Short-Description: alignak monitoring daemon
-# Description: alignak is a monitoring tool composed of many separated modules:
-# - arbiter : the main one : control everything else.
-# - scheduler : receives checks/actions from arbiter. Schedules & forwards them to pollers.
-# - poller : receives the checks from a scheduler. Launch them and returns results
-# - broker : manage results by looking at scheduler. Like export to flat file or db.
-# - reactionner : manage the failed checks by looking at scheduler.
-# - receiver : manage all passive data
-### END INIT INFO
-
-### Chkconfig Header
-# Alignak Starts Alignak daemons
-#
-# chkconfig: 345 99 01
-# description: Start Alignak daemons
-
-# Reference:
-# http://refspecs.linuxfoundation.org/LSB_4.1.0/LSB-Core-generic/LSB-Core-generic/iniscrptact.html
-
-
-NAME="alignak"
-
-AVAIL_MODULES="scheduler poller reactionner broker receiver arbiter"
-
-## ALIGNAK_MODULE_FILE is set by alignak-* if it's one of these that's calling us.
-if [ -z "$ALIGNAK_MODULE_FILE" ]; then
- SCRIPTNAME=$0
- _usage_mods_="[ <$AVAIL_MODULES> ]"
-else
- SCRIPTNAME=$ALIGNAK_MODULE_FILE
-fi
-
-curpath=$(cd $(dirname "$0") && pwd)
-#echo curpath is $curpath filename is $(basename "$0")
-
-
-export LANG=en_US.UTF8
-export LC_ALL=en_US.UTF8
-export PYTHONIOENCODING=utf8
-export PYTHONUNBUFFERED="0"
-export TZ=:/etc/localtime
-
-# default
-DEBUG=false
-CMD=""
-SUBMODULES=""
-
-# Try relative first (if we have /usr/local for example
-[ -z "$ALIGNAK_DEFAULT_FILE" ] && ALIGNAK_DEFAULT_FILE="${curpath}/../default/$NAME"
-[ ! -f "$ALIGNAK_DEFAULT_FILE" ] && ALIGNAK_DEFAULT_FILE="/etc/default/$NAME"
-
-
-
-usage() {
- cat << END
-Usage: $SCRIPTNAME [ -d ] {start|stop|status|restart|reload|force-reload|check} $_usage_mods_
-
- -d start requested module(s) in debug mode, only useful with start|restart
-
-END
-}
-
-if [ "$1" = "-d" ]; then
- DEBUG="1"
- shift
-fi
-
-if [ $# -eq 0 ]; then
- usage >&2
- exit 2
-fi
-
-CMD=$1
-shift
-SUBMODULES=$*
-
-# Reads configuration variable file if it is present
-[ -r "$ALIGNAK_DEFAULT_FILE" ] && . "$ALIGNAK_DEFAULT_FILE"
-
-if [ -z "$SUBMODULES" ]; then
- SUBMODULES=$AVAIL_MODULES
-else
- # check given modules
- for mod1 in $SUBMODULES; do
- found=0
- for mod2 in $AVAIL_MODULES; do
- [ $mod1 = $mod2 ] && found=1;
- done
- [ $found = 0 ] && { usage >&2 ; exit 2 ; }
- done
-fi
-
-# Now look if some required variables are pre defined:
-if [ -z "$ALIGNAKCFG" ]; then
- ALIGNAKCFG="$ETC/alignak.cfg"
-fi
-
-# If var or run dir is missing, create them and chown them
-[ ! -d $VAR ] && mkdir -p $VAR && chown $ALIGNAKUSER:$ALIGNAKGROUP $VAR
-[ ! -d $RUN ] && mkdir -p $RUN && chown $ALIGNAKUSER:$ALIGNAKGROUP $RUN
-
-# Now place us in our var directory so even our arbiter will be
-# happy for opening its pid and cmd files
-cd $VAR
-
-
-
-# In case not existing, define here
-log_failure_msg() {
- echo $*
- return 1
-}
-
-log_warning_msg() {
- echo $*
- return 1
-}
-
-log_end_msg() {
- code=$1
- shift
- echo $*
- return $code
-}
-
-# Load the VERBOSE setting and other rcS variables
-[ -f /etc/default/rcS ] && . /etc/default/rcS
-
-# Source function library.
-[ -f /etc/rc.d/init.d/functions ] && . /etc/rc.d/init.d/functions
-
-[ -f /lib/lsb/init-functions ] && . /lib/lsb/init-functions
-
-echo_success() {
- log_end_msg 0 $*
-}
-
-echo_failure() {
- log_end_msg 1 $*
-}
-
-################################################
-
-#
-# returns the pid for a submodule
-#
-
-getpidfile() {
- mod="$1"
- modPIDVAR=$(echo $mod | tr 'a-z' 'A-Z')"PID"
- pidfile=$(echo $(eval echo \${$modPIDVAR}))
- if test "$pidfile"
- then
- echo "$pidfile"
- else
- echo "$RUN/${mod}d.pid"
- fi
-}
-
-getmodpid() {
- mod=$1
- pidfile=$(getpidfile "$mod")
- if [ -s $pidfile ]; then
- cat $pidfile
- fi
-}
-
-
-getdebugfile() {
- mod="$1"
- modDEBUG=$(echo $mod | tr 'a-z' 'A-Z')"DEBUGFILE"
- debugfile=$(echo $(eval echo \${$modDEBUG}))
- if test "$debugfile"
- then
- echo "$debugfile"
- else
- echo "${VAR}/${mod}-debug.log"
- fi
-}
-
-#
-# Display status
-#
-do_status() {
- mod=$1
- pidfile=$(getpidfile "$mod")
- [ -e "$pidfile" ] || {
- echo "$mod NOT RUNNING (pidfile ($pidfile) not exist)"
- return 3
- }
- [ -r "$pidfile" ] || {
- echo "$mod NOT RUNNING (pidfile ($pidfile) unreadable)"
- return 3
- }
- pid=$(cat "$pidfile")
- if [ -z "$pid" ]; then
- echo "$mod NOT RUNNING (pid file empty)"
- return 4
- fi
- ps -p "$pid" >/dev/null 2>&1
- rc=$?
- if [ $rc != 0 ]; then
- log_failure_msg "$mod NOT RUNNING (process $pid doesn't exist?)"
- return 1
- fi
- echo "$mod RUNNING (pid $pid)"
- return 0
-}
-
-#
-# starts our modules
-#
-do_start() {
- mod=$1
- modfilepath="$BIN/alignak-${mod}"
- [ -e "$modfilepath" ] || {
- log_failure_msg "FAILED: did not find $mod file ($modfilepath) ; are you sure alignak-$mod is installed?"
- return 5
- }
- [ "$DEBUG" = 1 ] && DEBUGCMD="--debug "$(getdebugfile "$mod")
- # Arbiter alignak.cfg, and the other OTHERd.ini
- modINI=$(echo "$"${mod}CFG | tr '[:lower:]' '[:upper:]')
- modinifile=$(eval echo ${modINI})
- if [ "$mod" != "arbiter" ]; then
- output=$($modfilepath -d -c "${modinifile}" $DEBUGCMD 2>&1)
- rc=$?
- else
- if [ -z "$ALIGNAKSPECIFICCFG" ]; then
- output=$($modfilepath -d -c "${modinifile}" -a "$ALIGNAKCFG" $DEBUGCMD 2>&1)
- else
- output=$($modfilepath -d -c "${modinifile}" -a "$ALIGNAKCFG" -a "$ALIGNAKSPECIFICCFG" $DEBUGCMD 2>&1)
- fi
- rc=$?
- fi
- # debug:
- #resfile="/tmp/bad_start_for_$mod"
- #echo "$output" > "$resfile" || true
- if [ $rc != 0 ]; then
- resfile="/tmp/bad_start_for_$mod"
- echo "$output" > "$resfile" || true
- output=$(echo "$output" | tail -1)
- echo "FAILED: $output (full output is in $resfile)"
- return 1
- fi
- echo "OK"
- return 0
-}
-
-#
-# stops modules
-#
-do_stop() {
- mod=$1
- pid=$(getmodpid "$mod")
- statusoutput=$(do_status "$mod")
- [ $? -ne 0 ] && {
- echo "$statusoutput"
- return 0
- }
- if [ ! -z "$pid" ]; then
- kill "$pid"
- #sleep 1
- ## TODO: instead of 'sleep 1': wait up to when pid file is removed (with timeout)?
- for i in 1 2 3
- do
- # TODO: use a better way to get the children pids..
- allpids="$(ps -aef | grep "$pid" | grep "alignak-$mod" | awk '{print $2}')"
- if [ -z "$allpids" ]; then
- echo "OK"
- return 0
- fi
- sleep 1
- done
- echo "there are still remaining processes to $mod running.. ; trying to kill them (SIGTERM).."
- allpids="$(ps -aef | grep "$pid" | grep "alignak-$mod" | awk '{print $2}')"
- for cpid in $(ps -aef | grep "$pid" | grep "alignak-$mod" | awk '{print $2}'); do
- kill $cpid > /dev/null 2>&1
- done
- for i in 1 2 3
- do
- # TODO: eventually use a better way to get the children pids..
- allpids="$(ps -aef | grep "$pid" | grep "alignak-$mod" | awk '{print $2}')"
- if [ -z "$allpids" ]; then
- echo "OK"
- return 0
- fi
- sleep 1
- done
- echo "there are still remaining processes to $mod running.. ; trying to kill -9 them.."
- allpids="$(ps -aef | grep "$pid" | grep "alignak-$mod" | awk '{print $2}')"
- for cpid in $(ps -aef | grep "$pid" | grep "alignak-$mod" | awk '{print $2}'); do
- kill -9 $cpid > /dev/null 2>&1
- done
- sleep 1
- allpids="$(ps -aef | grep "$pid" | grep "alignak-$mod" | awk '{print $2}')"
- if [ ! -z "$allpids" ]; then
- echo "FAILED: one or more process for $mod are still running after kill -9!"
- echo "Remaining processes are (pids="$allpids"):"
- ps -lf $(for p in $allpids ; do echo -n "-p$p " ; done)
- echo "You should check this."
- return 1
- fi
- echo "OK"
- else
- echo "NOT RUNNING"
- fi
- return 0
-}
-
-#
-# does the config check
-#
-do_check() {
- echo "Checking configuration..."
- [ "$DEBUG" = 1 ] && DEBUGCMD="--debug $VAR/${mod}-debug.log"
-
- modINI=$(echo "$"${mod}CFG | tr '[:lower:]' '[:upper:]')
- modinifile=$(eval echo ${modINI})
-
- if [ -z "$ALIGNAKSPECIFICCFG" ]; then
- $BIN/alignak-arbiter -V -c "${modinifile}" -a "$ALIGNAKCFG" $DEBUGCMD 2>&1
- else
- $BIN/alignak-arbiter -V -c "${modinifile}" -a "$ALIGNAKCFG" -a "$ALIGNAKSPECIFICCFG" $DEBUGCMD 2>&1
- fi
- rc=$?
- if [ $rc -eq 0 ]; then
- echo_success
- else
- echo "$startoutput"
- echo_failure
- fi
- return $?
-}
-
-
-############################
-
-do_start_() {
- echo "Starting $1: "
- status=$(do_status "$1")
- rc=$?
- if [ $rc -eq 0 ]; then
- log_warning_msg "Already running"
- return
- fi
- startoutput=$(do_start "$1")
- rc=$?
- if [ $rc -eq 0 ]; then
- echo_success
- else
- echo "$startoutput"
- echo_failure
- fi
- return $rc
-}
-
-do_stop_() {
- echo "Stopping $1"
- statusoutput=$(do_status "$1")
- rc=$?
- if [ $rc -ne 0 ]; then
- failuremsg="Couldn't get status of $1: $statusoutput"
- else
- stopoutput=$(do_stop "$1" 2>&1)
- rc=$?
- [ $rc -ne 0 ] && failuremsg="Couldn't stop $1: $stopoutput"
- fi
- if [ $rc -ne 0 ]; then
- log_failure_msg "$failuremsg"
- echo_failure
- else
- echo_success
- fi
- return $rc
-}
-
-do_restart_() {
- mod="$1"
- if [ "$mod" = "arbiter" ]; then
- do_check_ "$mod"
- checkrc=$?
- if [ $checkrc -ne 0 ]; then
- return 1
- fi
- fi
- echo "Restarting $mod"
- stopoutput=$(do_stop "$mod")
- startoutput=$(do_start "$mod")
- rc=$?
- if [ $rc -eq 0 ]; then
- echo_success
- else
- log_failure_msg "$startoutput"
- echo_failure
- fi
- return $rc
-}
-
-do_force_reload_() {
- do_restart_ $1
-}
-
-do_reload_() {
- mod="$1"
- if [ "$mod" = "arbiter" ]; then
- do_status_ $mod
- checkrc=$?
- if [ $checkrc -ne 0 ]; then
- echo "Cannot request reload if process is not running."
- return 1
- fi
- do_check_ "$mod"
- checkrc=$?
- if [ $checkrc -ne 0 ]; then
- return 1
- fi
- pid=$(getmodpid "$mod")
- if [ "$pid" != "" ]; then
- # send SIGHUP signal to reload configuration
- kill -1 $pid
- rc=$?
- fi
- else
- # if not the arbiter module, reload == restart
- do_restart_ $mod
- fi
- echo "Reloading $mod"
- if [ $rc -eq 0 ]; then
- echo_success
- else
- echo_failure
- fi
- return $rc
-}
-
-do_status_() {
- mod=$1
- echo "Checking status of $mod"
- do_status "$1"
- rc=$?
- if [ $rc -eq 0 ]; then
- echo_success
- else
- echo_failure
- fi
-
-}
-
-do_check_() {
- echo "Doing config check"
- output=$(do_check "$1" 2>&1)
- rc=$?
- check_res_file=$(mktemp /tmp/alignak_checkconfig_resultXXXXXXXX)
- echo "$output" > "$check_res_file"
- mv $check_res_file /tmp/alignak_checkconfig_result
- check_res_file="/tmp/alignak_checkconfig_result"
-
- if [ $rc -eq 0 ]; then
- echo_success
- else
- output=$(echo "$output" | tail -1)
- log_warning_msg "full result is in ${check_res_file}"
- log_failure_msg "ConfigCheck failed: $output"
- echo_failure
- fi
- return $rc
-}
-do_checkconfig_() { do_check_ "$1" ; }
-
-
-############################
-
-do_cmd_on() {
- action=$1
- mods=$2
-
- local return_value
- return_value=0
-
- for mod in $mods
- do
- # If at least one action fails, the return value is 1.
- do_${action}_ "$mod" || return_value=1
- done
-
- return $return_value
-}
-
-
-############################
-## Main:
-
-case "$CMD" in
- start|stop|restart|status|force-reload)
- do_cmd_on "$CMD" "$SUBMODULES"
- ;;
- force-reload)
- do_cmd_on "force_reload" "$SUBMODULES"
- ;;
- check|checkconfig|reload)
- do_cmd_on "$CMD" "arbiter"
- ;;
- *)
- usage >&2
- exit 2
- ;;
-esac
-
diff --git a/bin/init.d/alignak-arbiter b/bin/init.d/alignak-arbiter
deleted file mode 100755
index ef85e8c2f..000000000
--- a/bin/init.d/alignak-arbiter
+++ /dev/null
@@ -1,83 +0,0 @@
-#!/bin/sh
-#
-# Copyright (C) 2015-2016: Alignak team, see AUTHORS.txt file for contributors
-#
-# This file is part of Alignak.
-#
-# Alignak is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# Alignak is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with Alignak. If not, see .
-#
-#
-# This file incorporates work covered by the following copyright and
-# permission notice:
-#
-# Copyright (C) 2009-2014:
-# Gabes Jean, naparuba@gmail.com
-# Gerhard Lausser, Gerhard.Lausser@consol.de
-# Gregory Starck, g.starck@gmail.com
-# Hartmut Goebel, h.goebel@goebel-consult.de
-#
-# This file is part of Shinken.
-#
-# Shinken is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# Shinken is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with Shinken. If not, see .
-
-### BEGIN INIT INFO
-# Provides: alignak-arbiter
-# Required-Start: $all
-# Required-Stop: $all
-# Default-Start: 2 3 4 5
-# Default-Stop: 0 1 6
-# Short-Description: Alignak arbiter daemon
-# Description: Alignak is a monitoring tool and the Arbiter
-# is one of its daemon. This one reads the configuration,
-# cuts it into parts and dispatches it. Then it waits
-# for orders from the users to dispatch them too.
-### END INIT INFO
-
-### Chkconfig Header
-# Alignak Starts Alignak Arbiter
-#
-# chkconfig: 345 99 01
-# description: Start Alignak arbiter daemon
-
-# Author: Gabes Jean
-# Olivier LI-KIANG-CHEONG
-
-SHORTNAME=arbiter
-NAME="alignak-$SHORTNAME"
-SCRIPT=$(readlink -f "$0")
-curdir=$(dirname "$SCRIPT")
-
-export ALIGNAK_MODULE_FILE="$NAME" ## for 'alignak' init script to see that it's called by us
-
-case "$1" in
- start|stop|reload|restart|force-reload|status|check|checkconfig)
- "$curdir/alignak" $@ "$SHORTNAME"
- exit $?
- ;;
- *)
- echo "Usage: /etc/init.d/$NAME [-d] {start|stop|reload|restart|force-reload|status|check}"
- exit 1
- ;;
-esac
diff --git a/bin/init.d/alignak-broker b/bin/init.d/alignak-broker
deleted file mode 100755
index 5aff95e99..000000000
--- a/bin/init.d/alignak-broker
+++ /dev/null
@@ -1,83 +0,0 @@
-#!/bin/sh
-#
-# Copyright (C) 2015-2016: Alignak team, see AUTHORS.txt file for contributors
-#
-# This file is part of Alignak.
-#
-# Alignak is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# Alignak is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with Alignak. If not, see .
-#
-#
-# This file incorporates work covered by the following copyright and
-# permission notice:
-#
-# Copyright (C) 2009-2014:
-# Gabes Jean, naparuba@gmail.com
-# Gerhard Lausser, Gerhard.Lausser@consol.de
-# Gregory Starck, g.starck@gmail.com
-# Hartmut Goebel, h.goebel@goebel-consult.de
-#
-# This file is part of Shinken.
-#
-# Shinken is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# Shinken is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with Shinken. If not, see .
-
-### BEGIN INIT INFO
-# Provides: alignak-broker
-# Required-Start: $all
-# Required-Stop: $all
-# Default-Start: 2 3 4 5
-# Default-Stop: 0 1 6
-# Short-Description: Alignak broker daemon
-# Description: Alignak is a monitoring tool and the Broker
-# is one of its daemon. This one gets the configuration from the arbiter
-# His purpose is to get the broks from the schedulers specified in the
-# configuration
-### END INIT INFO
-
-### Chkconfig Header
-# Alignak Starts Alignak Broker
-#
-# chkconfig: 345 99 01
-# description: Start Alignak broker daemon
-
-# Author: Gabes Jean
-# Olivier LI-KIANG-CHEONG
-
-SHORTNAME=broker
-NAME="alignak-$SHORTNAME"
-SCRIPT=$(readlink -f "$0")
-curdir=$(dirname "$SCRIPT")
-
-export ALIGNAK_MODULE_FILE="$NAME" ## for 'alignak' init script to see that it's called by us
-
-case "$1" in
- start|stop|reload|restart|force-reload|status|check|checkconfig)
- "$curdir/alignak" $@ "$SHORTNAME"
- exit $?
- ;;
- *)
- echo "Usage: /etc/init.d/$NAME [-d] {start|stop|reload|restart|force-reload|status|check}"
- exit 1
- ;;
-esac
diff --git a/bin/init.d/alignak-poller b/bin/init.d/alignak-poller
deleted file mode 100755
index 1d614cb39..000000000
--- a/bin/init.d/alignak-poller
+++ /dev/null
@@ -1,84 +0,0 @@
-#!/bin/sh
-#
-# Copyright (C) 2015-2016: Alignak team, see AUTHORS.txt file for contributors
-#
-# This file is part of Alignak.
-#
-# Alignak is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# Alignak is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with Alignak. If not, see .
-#
-#
-# This file incorporates work covered by the following copyright and
-# permission notice:
-#
-# Copyright (C) 2009-2014:
-# Gabes Jean, naparuba@gmail.com
-# Gerhard Lausser, Gerhard.Lausser@consol.de
-# Gregory Starck, g.starck@gmail.com
-# Hartmut Goebel, h.goebel@goebel-consult.de
-#
-# This file is part of Shinken.
-#
-# Shinken is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# Shinken is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with Shinken. If not, see .
-
-### BEGIN INIT INFO
-# Provides: alignak-poller
-# Required-Start: $all
-# Required-Stop: $all
-# Default-Start: 2 3 4 5
-# Default-Stop: 0 1 6
-# Short-Description: Alignak poller daemon
-# Description: Alignak is a monitoring tool and the Poller
-# is one of its daemon. This one gets the configuration from the arbiter
-# His purpose is to actually do the checks ordered by the schedulers,
-# and then sends the results to the schedulers specified in the
-# configuration
-### END INIT INFO
-
-### Chkconfig Header
-# Alignak Starts Alignak Poller
-#
-# chkconfig: 345 99 01
-# description: Start Alignak poller daemon
-
-# Author: Gabes Jean
-# Olivier LI-KIANG-CHEONG
-
-SHORTNAME=poller
-NAME="alignak-$SHORTNAME"
-SCRIPT=$(readlink -f "$0")
-curdir=$(dirname "$SCRIPT")
-
-export ALIGNAK_MODULE_FILE="$NAME" ## for 'alignak' init script to see that it's called by us
-
-case "$1" in
- start|stop|reload|restart|force-reload|status|check|checkconfig)
- "$curdir/alignak" $@ "$SHORTNAME"
- exit $?
- ;;
- *)
- echo "Usage: /etc/init.d/$NAME [-d] {start|stop|reload|restart|force-reload|status|check}"
- exit 1
- ;;
-esac
diff --git a/bin/init.d/alignak-reactionner b/bin/init.d/alignak-reactionner
deleted file mode 100755
index 39fc3d9ec..000000000
--- a/bin/init.d/alignak-reactionner
+++ /dev/null
@@ -1,83 +0,0 @@
-#!/bin/sh
-#
-# Copyright (C) 2015-2016: Alignak team, see AUTHORS.txt file for contributors
-#
-# This file is part of Alignak.
-#
-# Alignak is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# Alignak is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with Alignak. If not, see .
-#
-#
-# This file incorporates work covered by the following copyright and
-# permission notice:
-#
-# Copyright (C) 2009-2014:
-# Gabes Jean, naparuba@gmail.com
-# Gerhard Lausser, Gerhard.Lausser@consol.de
-# Gregory Starck, g.starck@gmail.com
-# Hartmut Goebel, h.goebel@goebel-consult.de
-#
-# This file is part of Shinken.
-#
-# Shinken is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# Shinken is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with Shinken. If not, see .
-
-### BEGIN INIT INFO
-# Provides: alignak-reactionner
-# Required-Start: $all
-# Required-Stop: $all
-# Default-Start: 2 3 4 5
-# Default-Stop: 0 1 6
-# Short-Description: Alignak reactionner daemon
-# Description: Alignak is a monitoring tool and the Reactionner
-# is one of its daemon. This one gets the configuration from the arbiter
-# His purpose is to get the actually do the actions like sending an email
-# ordered by the schedulers specified in the configuration
-### END INIT INFO
-
-### Chkconfig Header
-# Alignak Starts Alignak Reactionner
-#
-# chkconfig: 345 99 01
-# description: Start Alignak reactionner daemon
-
-# Author: Gabes Jean
-# Olivier LI-KIANG-CHEONG
-
-SHORTNAME=reactionner
-NAME="alignak-$SHORTNAME"
-SCRIPT=$(readlink -f "$0")
-curdir=$(dirname "$SCRIPT")
-
-export ALIGNAK_MODULE_FILE="$NAME" ## for 'alignak' init script to see that it's called by us
-
-case "$1" in
- start|stop|reload|restart|force-reload|status|check|checkconfig)
- "$curdir/alignak" $@ "$SHORTNAME"
- exit $?
- ;;
- *)
- echo "Usage: /etc/init.d/$NAME [-d] {start|stop|reload|restart|force-reload|status|check}"
- exit 1
- ;;
-esac
diff --git a/bin/init.d/alignak-receiver b/bin/init.d/alignak-receiver
deleted file mode 100755
index 1a5eaae5a..000000000
--- a/bin/init.d/alignak-receiver
+++ /dev/null
@@ -1,83 +0,0 @@
-#!/bin/sh
-#
-# Copyright (C) 2015-2016: Alignak team, see AUTHORS.txt file for contributors
-#
-# This file is part of Alignak.
-#
-# Alignak is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# Alignak is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with Alignak. If not, see .
-#
-#
-# This file incorporates work covered by the following copyright and
-# permission notice:
-#
-# Copyright (C) 2009-2014:
-# Gabes Jean, naparuba@gmail.com
-# Gerhard Lausser, Gerhard.Lausser@consol.de
-# Gregory Starck, g.starck@gmail.com
-# Hartmut Goebel, h.goebel@goebel-consult.de
-#
-# This file is part of Shinken.
-#
-# Shinken is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# Shinken is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with Shinken. If not, see .
-
-### BEGIN INIT INFO
-# Provides: alignak-receiver
-# Required-Start: $all
-# Required-Stop: $all
-# Default-Start: 2 3 4 5
-# Default-Stop: 0 1 6
-# Short-Description: Alignak receiver daemon
-# Description: Alignak is a monitoring tool and the Receiver
-# is one of its daemon. This one gets the configuration from the arbiter
-# His purpose is to get the broks from the schedulers specified in the
-# configuration
-### END INIT INFO
-
-### Chkconfig Header
-# Alignak Starts Alignak Receiver
-#
-# chkconfig: 345 99 01
-# description: Start Alignak receiver daemon
-
-# Author: Gabes Jean
-# Olivier LI-KIANG-CHEONG
-
-SHORTNAME=receiver
-NAME="alignak-$SHORTNAME"
-SCRIPT=$(readlink -f "$0")
-curdir=$(dirname "$SCRIPT")
-
-export ALIGNAK_MODULE_FILE="$NAME" ## for 'alignak' init script to see that it's called by us
-
-case "$1" in
- start|stop|reload|restart|force-reload|status|check|checkconfig)
- "$curdir/alignak" $@ "$SHORTNAME"
- exit $?
- ;;
- *)
- echo "Usage: /etc/init.d/$NAME [-d] {start|stop|reload|restart|force-reload|status|check}"
- exit 1
- ;;
-esac
diff --git a/bin/init.d/alignak-scheduler b/bin/init.d/alignak-scheduler
deleted file mode 100755
index 798e23fa0..000000000
--- a/bin/init.d/alignak-scheduler
+++ /dev/null
@@ -1,83 +0,0 @@
-#!/bin/sh
-#
-# Copyright (C) 2015-2016: Alignak team, see AUTHORS.txt file for contributors
-#
-# This file is part of Alignak.
-#
-# Alignak is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# Alignak is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with Alignak. If not, see .
-#
-#
-# This file incorporates work covered by the following copyright and
-# permission notice:
-#
-# Copyright (C) 2009-2014:
-# Gabes Jean, naparuba@gmail.com
-# Gerhard Lausser, Gerhard.Lausser@consol.de
-# Gregory Starck, g.starck@gmail.com
-# Hartmut Goebel, h.goebel@goebel-consult.de
-#
-# This file is part of Shinken.
-#
-# Shinken is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# Shinken is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with Shinken. If not, see .
-
-### BEGIN INIT INFO
-# Provides: alignak-scheduler
-# Required-Start: $all
-# Required-Stop: $all
-# Default-Start: 2 3 4 5
-# Default-Stop: 0 1 6
-# Short-Description: Alignak scheduler daemon
-# Description: Alignak is a monitoring tool and the Scheduler
-# is one of its daemon. This one get configuration from the arbiter
-# His purpose is only to schedule do the checks and actions specified
-# in the configuration received from the arbiter
-### END INIT INFO
-
-### Chkconfig Header
-# Alignak Starts Alignak Scheduler
-#
-# chkconfig: 345 99 01
-# description: Start Alignak scheduler daemon
-
-# Author: Gabes Jean
-# Olivier LI-KIANG-CHEONG
-
-SHORTNAME=scheduler
-NAME="alignak-$SHORTNAME"
-SCRIPT=$(readlink -f "$0")
-curdir=$(dirname "$SCRIPT")
-
-export ALIGNAK_MODULE_FILE="$NAME" ## for 'alignak' init script to see that it's called by us
-
-case "$1" in
- start|stop|reload|restart|force-reload|status|check|checkconfig)
- "$curdir/alignak" $@ "$SHORTNAME"
- exit $?
- ;;
- *)
- echo "Usage: /etc/init.d/$NAME [-d] {start|stop|reload|restart|force-reload|status|check}"
- exit 1
- ;;
-esac
diff --git a/bin/rc.d/alignak-arbiter b/bin/rc.d/alignak-arbiter
deleted file mode 100755
index 2f1debb9a..000000000
--- a/bin/rc.d/alignak-arbiter
+++ /dev/null
@@ -1,42 +0,0 @@
-#!/bin/sh
-
-# $FreeBSD$
-#
-# PROVIDE: alignak_arbiter
-# REQUIRE: LOGIN
-# KEYWORD: shutdown
-
-. /etc/rc.subr
-
-name="alignak_arbiter"
-rcvar="alignak_arbiter_enable"
-
-alignak_arbiter_daemonfile="/usr/local/etc/alignak/daemons/arbiterd.ini"
-alignak_arbiter_configfile="/usr/local/etc/alignak/alignak.cfg"
-command="/usr/local/bin/alignak-arbiter"
-command_interpreter="/usr/local/bin/python2.7"
-command_args="-d -c ${alignak_arbiter_daemonfile} -a ${alignak_arbiter_configfile} > /dev/null 2>&1"
-pidfile="/var/run/alignak/arbiterd.pid"
-
-restart_precmd="alignak_checkconfig"
-configtest_cmd="alignak_checkconfig"
-
-required_files="${alignak_arbiter_configfile}"
-extra_commands="configtest"
-
-load_rc_config "${name}"
-
-[ -z "${alignak_arbiter_enable}" ] && alignak_arbiter_enable="NO"
-
-alignak_checkconfig() {
- echo -n "Performing sanity check on alignak configuration: "
- ${command} -V -a ${alignak_arbiter_configfile} >/dev/null 2>&1
- if [ $? -ne 0 ]; then
- echo "FAILED"
- return 1
- else
- echo "OK"
- fi
-}
-
-run_rc_command "$1"
diff --git a/bin/rc.d/alignak-broker b/bin/rc.d/alignak-broker
deleted file mode 100755
index 9640c3c87..000000000
--- a/bin/rc.d/alignak-broker
+++ /dev/null
@@ -1,26 +0,0 @@
-#!/bin/sh
-
-# $FreeBSD$
-#
-# PROVIDE: alignak_broker
-# REQUIRE: LOGIN
-# KEYWORD: shutdown
-
-. /etc/rc.subr
-
-name="alignak_broker"
-rcvar="alignak_broker_enable"
-
-alignak_broker_configfile="/usr/local/etc/alignak/daemons/brokerd.ini"
-command="/usr/local/bin/alignak-broker"
-command_interpreter="/usr/local/bin/python2.7"
-command_args="-d -c ${alignak_broker_configfile} > /dev/null 2>&1"
-pidfile="/var/run/alignak/brokerd.pid"
-
-required_files="${alignak_broker_configfile}"
-
-load_rc_config "${name}"
-
-[ -z "${alignak_broker_enable}" ] && alignak_broker_enable="NO"
-
-run_rc_command "$1"
diff --git a/bin/rc.d/alignak-poller b/bin/rc.d/alignak-poller
deleted file mode 100755
index 1a49cc25f..000000000
--- a/bin/rc.d/alignak-poller
+++ /dev/null
@@ -1,26 +0,0 @@
-#!/bin/sh
-
-# $FreeBSD$
-#
-# PROVIDE: alignak_poller
-# REQUIRE: LOGIN
-# KEYWORD: shutdown
-
-. /etc/rc.subr
-
-name="alignak_poller"
-rcvar="alignak_poller_enable"
-
-alignak_poller_configfile="/usr/local/etc/alignak/daemons/pollerd.ini"
-command="/usr/local/bin/alignak-poller"
-command_interpreter="/usr/local/bin/python2.7"
-command_args="-d -c ${alignak_poller_configfile} > /dev/null 2>&1"
-pidfile="/var/run/alignak/pollerd.pid"
-
-required_files="${alignak_poller_configfile}"
-
-load_rc_config "${name}"
-
-[ -z "${alignak_poller_enable}" ] && alignak_poller_enable="NO"
-
-run_rc_command "$1"
diff --git a/bin/rc.d/alignak-reactionner b/bin/rc.d/alignak-reactionner
deleted file mode 100755
index 0486cc622..000000000
--- a/bin/rc.d/alignak-reactionner
+++ /dev/null
@@ -1,26 +0,0 @@
-#!/bin/sh
-
-# $FreeBSD$
-#
-# PROVIDE: alignak_reactionner
-# REQUIRE: LOGIN
-# KEYWORD: shutdown
-
-. /etc/rc.subr
-
-name="alignak_reactionner"
-rcvar="alignak_reactionner_enable"
-
-alignak_reactionner_configfile="/usr/local/etc/alignak/daemons/reactionnerd.ini"
-command="/usr/local/bin/alignak-reactionner"
-command_interpreter="/usr/local/bin/python2.7"
-command_args="-d -c ${alignak_reactionner_configfile} > /dev/null 2>&1"
-pidfile="/var/run/alignak/reactionnerd.pid"
-
-required_files="${alignak_reactionner_configfile}"
-
-load_rc_config "${name}"
-
-[ -z "${alignak_reactionner_enable}" ] && alignak_reactionner_enable="NO"
-
-run_rc_command "$1"
diff --git a/bin/rc.d/alignak-receiver b/bin/rc.d/alignak-receiver
deleted file mode 100755
index 62f952cf6..000000000
--- a/bin/rc.d/alignak-receiver
+++ /dev/null
@@ -1,26 +0,0 @@
-#!/bin/sh
-
-# $FreeBSD$
-#
-# PROVIDE: alignak_receiver
-# REQUIRE: LOGIN
-# KEYWORD: shutdown
-
-. /etc/rc.subr
-
-name="alignak_receiver"
-rcvar="alignak_receiver_enable"
-
-alignak_receiver_configfile="/usr/local/etc/alignak/daemons/receiverd.ini"
-command="/usr/local/bin/alignak-receiver"
-command_interpreter="/usr/local/bin/python2.7"
-command_args="-d -c ${alignak_receiver_configfile} > /dev/null 2>&1"
-pidfile="/var/run/alignak/receiverd.pid"
-
-required_files="${alignak_receiver_configfile}"
-
-load_rc_config "${name}"
-
-[ -z "${alignak_receiver_enable}" ] && alignak_receiver_enable="NO"
-
-run_rc_command "$1"
diff --git a/bin/rc.d/alignak-scheduler b/bin/rc.d/alignak-scheduler
deleted file mode 100755
index 66b6f1e68..000000000
--- a/bin/rc.d/alignak-scheduler
+++ /dev/null
@@ -1,26 +0,0 @@
-#!/bin/sh
-
-# $FreeBSD$
-#
-# PROVIDE: alignak_scheduler
-# REQUIRE: LOGIN
-# KEYWORD: shutdown
-
-. /etc/rc.subr
-
-name="alignak_scheduler"
-rcvar="alignak_scheduler_enable"
-
-alignak_scheduler_configfile="/usr/local/etc/alignak/daemons/schedulerd.ini"
-command="/usr/local/bin/alignak-scheduler"
-command_interpreter="/usr/local/bin/python2.7"
-command_args="-d -c ${alignak_scheduler_configfile} > /dev/null 2>&1"
-pidfile="/var/run/alignak/schedulerd.pid"
-
-required_files="${alignak_scheduler_configfile}"
-
-load_rc_config "${name}"
-
-[ -z "${alignak_scheduler_enable}" ] && alignak_scheduler_enable="NO"
-
-run_rc_command "$1"
diff --git a/dev/_launch_daemon.sh b/dev/_launch_daemon.sh
new file mode 100755
index 000000000..6d42c9890
--- /dev/null
+++ b/dev/_launch_daemon.sh
@@ -0,0 +1,163 @@
+#!/bin/bash
+
+#
+# Copyright (C) 2015-2016: Alignak team, see AUTHORS.txt file for contributors
+#
+# This file is part of Alignak.
+#
+# Alignak is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# Alignak is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with Alignak. If not, see .
+#
+DIR="$(cd $(dirname "$0"); pwd)"
+# Default is no debug
+DEBUG_MODE="0"
+# Default is to use configuration file for the daemons
+CONFIG_MODE="1"
+# Default is no replace for the daemons
+REPLACE=""
+# Default is to daemonize
+DAEMONIZE="--daemon"
+# Default is a simple daemon (no monitoring configuration file)
+ARBITER_MODE="0"
+# Default is running mode - do not only verify the configuration
+VERIFY_MODE="0"
+
+usage() {
+ cat << END
+
+Usage: $0 [-h|--help] [-v|--version] [-d|--debug] [-a|--arbiter] [-n|--no-daemon] [-V|--verify] daemon_name
+
+ -h (--help) display this message
+ -v (--version) display alignak version
+ -d (--debug) start requested daemon in debug mode
+ -c (--config) start requested daemon without its configuration file
+ Default is to start with the daemon configuration file
+ This option allow to use the default daemon parameters and the pid and
+ log files are stored in the current working directory
+ -r (--replace) do not replace an existing daemon (if valid pid file exists)
+ -n (--no-daemon) start requested daemon in console mode (do not daemonize)
+ -a (--arbiter) start requested daemon in arbiter mode
+ This option adds the monitoring configuration file(s) on the command line
+ This option will raise an error if the the daemon is not an arbiter.
+ -V (--verify) start requested daemon in verify mode (only for the arbiter)
+ This option will raise an error if the the daemon is not an arbiter.
+
+END
+}
+
+# Parse command line arguments
+if [ $# -eq 0 ]; then
+ usage >&2
+ exit 1
+fi
+
+for i in "$@"
+do
+case $i in
+ -h|--help)
+ usage >&1
+ exit 0
+ ;;
+ -d|--debug)
+ DEBUG_MODE="1"
+ shift
+ ;;
+ -a|--arbiter)
+ ARBITER_MODE="1"
+ shift
+ ;;
+ -c|--config)
+ CONFIG_MODE="0"
+ shift
+ ;;
+ -n|--no-daemon)
+ DAEMONIZE=""
+ shift
+ ;;
+ -r|--replace)
+ REPLACE="--replace"
+ shift
+ ;;
+ -V|--verify)
+ VERIFY_MODE="1"
+ shift
+ ;;
+ *)
+ DAEMON_NAME="$i"
+ shift
+ ;;
+esac
+done
+
+# Get the daemon's variables names (only the name, not the value)
+scr_var="${DAEMON_NAME}_DAEMON"
+cfg_var="${DAEMON_NAME}_CFG"
+dbg_var="${DAEMON_NAME}_DEBUGFILE"
+
+# Get Alignak configuration and parse the result to declare environment variables
+while IFS=';' read -ra VAR; do
+ for v in "${VAR[@]}"; do
+ eval "$v"
+ done
+done <<< "$($DIR/../alignak/bin/alignak_environment.py ../etc/alignak.ini)"
+
+if [ ${ALIGNAKCFG} ]; then
+ echo "Alignak main configuration file is defined in the environment"
+ ALIGNAK_CONFIGURATION_CFG="$ALIGNAKCFG"
+fi
+
+if [ ${ALIGNAKSPECIFICCFG} ]; then
+ echo "Alignak specific configuration file is defined in the environment"
+ ALIGNAK_CONFIGURATION_SPECIFICCFG="$ALIGNAKSPECIFICCFG"
+fi
+
+echo "---"
+echo "Alignak daemon: $DAEMON_NAME"
+echo "---"
+echo "Alignak configuration file: $ALIGNAK_CONFIGURATION_CFG"
+echo "Alignak extra configuration file: $ALIGNAK_CONFIGURATION_SPECIFICCFG"
+echo "---"
+echo "Daemon script: $scr_var = ${!scr_var}"
+echo "Daemon configuration: $cfg_var = ${!cfg_var}"
+echo "Daemon debug file: $dbg_var = ${!dbg_var}"
+echo "---"
+
+DEBUG_FILE=""
+if [ "$DEBUG_MODE" = "1" ]; then
+ DEBUG_FILE="--debugfile ${!dbg_var}"
+ echo "Launching the daemon: $DAEMON_NAME in debug mode, log: ${!dbg_var}"
+fi
+
+CONFIG_FILE=""
+if [ "$CONFIG_MODE" = "1" ]; then
+ CONFIG_FILE="--config ${!cfg_var}"
+ echo "Launching the daemon: $DAEMON_NAME with configuration file: ${!cfg_var}"
+fi
+
+MONITORING_CONFIG_FILES="--arbiter ${ALIGNAK_CONFIGURATION_CFG}"
+if [ ! "$ALIGNAK_CONFIGURATION_SPECIFICCFG" = "" ]; then
+ MONITORING_CONFIG_FILES="--arbiter ${ALIGNAK_CONFIGURATION_CFG} --arbiter ${ALIGNAK_CONFIGURATION_SPECIFICCFG}"
+fi
+
+if [ "$ARBITER_MODE" = "1" ]; then
+ if [ "$VERIFY_MODE" = "1" ]; then
+ echo "Launching the daemon: $DAEMON_NAME in verify mode, configuration: ${MONITORING_CONFIG_FILES}"
+ "${!scr_var}" --verify-config $CONFIG_FILE $MONITORING_CONFIG_FILES $DEBUG_FILE $DAEMONIZE $REPLACE
+ else
+ echo "Launching the daemon: $DAEMON_NAME in arbiter mode, configuration: ${MONITORING_CONFIG_FILES}"
+ "${!scr_var}" $CONFIG_FILE $MONITORING_CONFIG_FILES $DEBUG_FILE $DAEMONIZE $REPLACE
+ fi
+else
+ echo "Launching the daemon: $DAEMON_NAME"
+ "${!scr_var}" $CONFIG_FILE $DEBUG_FILE $DAEMONIZE $REPLACE
+fi
diff --git a/dev/_stop_daemon.sh b/dev/_stop_daemon.sh
new file mode 100755
index 000000000..bd582ecb9
--- /dev/null
+++ b/dev/_stop_daemon.sh
@@ -0,0 +1,73 @@
+#!/bin/bash
+
+#
+# Copyright (C) 2015-2016: Alignak team, see AUTHORS.txt file for contributors
+#
+# This file is part of Alignak.
+#
+# Alignak is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# Alignak is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with Alignak. If not, see .
+#
+DIR="$(cd $(dirname "$0"); pwd)"
+
+usage() {
+ cat << END
+
+Usage: $0 daemon_name
+
+END
+}
+
+if [ $# -eq 0 ]; then
+ usage >&2
+ exit 1
+fi
+
+DAEMON_NAME="$1"
+
+# Get the daemon's variables names (only the name, not the value)
+scr_var="${DAEMON_NAME}_DAEMON"
+proc_var="${DAEMON_NAME}_PROCESS"
+cfg_var="${DAEMON_NAME}_CFG"
+dbg_var="${DAEMON_NAME}_DEBUGFILE"
+
+# Get Alignak configuration and parse the result to declare environment variables
+while IFS=';' read -ra VAR; do
+ for v in "${VAR[@]}"; do
+ eval "$v"
+ done
+done <<< "$($DIR/../alignak/bin/alignak_environment.py ../etc/alignak.ini)"
+
+
+echo "---"
+echo "Alignak daemon: $DAEMON_NAME"
+echo "---"
+echo "Alignak configuration file: $ALIGNAK_CONFIGURATION_CFG"
+echo "Alignak extra configuration file: $ALIGNAK_CONFIGURATION_SPECIFICCFG"
+echo "---"
+echo "Daemon script: $scr_var = ${!scr_var}"
+echo "Daemon process: $proc_var = ${!proc_var}"
+echo "Daemon configuration: $cfg_var = ${!cfg_var}"
+echo "Daemon debug file: $dbg_var = ${!dbg_var}"
+echo "---"
+
+echo "---"
+echo "Stopping the daemon: $DAEMON_NAME"
+processes=${!proc_var:0:15}
+echo "Killing process(es) starting with: $processes"
+pkill $processes
+if [ $? -eq 0 ]; then
+ echo "Killed"
+else
+ echo "Error when killing process(es): $processes"
+fi
diff --git a/dev/launch_all.sh b/dev/launch_all.sh
index 9c590c4ab..732335ee6 100755
--- a/dev/launch_all.sh
+++ b/dev/launch_all.sh
@@ -1,4 +1,5 @@
-#!/bin/sh
+#!/bin/bash
+
#
# Copyright (C) 2015-2016: Alignak team, see AUTHORS.txt file for contributors
#
@@ -17,42 +18,15 @@
# You should have received a copy of the GNU Affero General Public License
# along with Alignak. If not, see .
#
-#
-# This file incorporates work covered by the following copyright and
-# permission notice:
-#
-# Copyright (C) 2009-2014:
-# Gabes Jean, naparuba@gmail.com
-# Gerhard Lausser, Gerhard.Lausser@consol.de
-# Gregory Starck, g.starck@gmail.com
-# Hartmut Goebel, h.goebel@goebel-consult.de
-#
-# This file is part of Shinken.
-#
-# Shinken is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# Shinken is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with Shinken. If not, see .
-
-
DIR="$(cd $(dirname "$0"); pwd)"
-echo "Going to dir $DIR"
-cd "$DIR"/..
-
-export LANG=us_US.UTF-8
+#
+# Run this script with the -d parameter to start all the daemons in debug mode
+#
-"$DIR"/launch_scheduler.sh
-"$DIR"/launch_poller.sh
-"$DIR"/launch_reactionner.sh
-"$DIR"/launch_broker.sh
-"$DIR"/launch_receiver.sh
-"$DIR"/launch_arbiter.sh
+"$DIR"/launch_scheduler.sh $@
+"$DIR"/launch_poller.sh $@
+"$DIR"/launch_reactionner.sh $@
+"$DIR"/launch_broker.sh $@
+"$DIR"/launch_receiver.sh $@
+"$DIR"/launch_arbiter.sh $@
diff --git a/dev/launch_all_debug.sh b/dev/launch_all_debug.sh
deleted file mode 100755
index 5dbaa8988..000000000
--- a/dev/launch_all_debug.sh
+++ /dev/null
@@ -1,65 +0,0 @@
-#!/bin/sh
-#
-# Copyright (C) 2015-2016: Alignak team, see AUTHORS.txt file for contributors
-#
-# This file is part of Alignak.
-#
-# Alignak is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# Alignak is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with Alignak. If not, see .
-#
-#
-# This file incorporates work covered by the following copyright and
-# permission notice:
-#
-# Copyright (C) 2009-2014:
-# Gabes Jean, naparuba@gmail.com
-# Gerhard Lausser, Gerhard.Lausser@consol.de
-# Gregory Starck, g.starck@gmail.com
-# Hartmut Goebel, h.goebel@goebel-consult.de
-#
-# This file is part of Shinken.
-#
-# Shinken is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# Shinken is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with Shinken. If not, see .
-
-
-DIR="$(cd $(dirname "$0"); pwd)"
-echo "$DIR"
-
-# Prepare the launch by cleaning var/log directories
-. $DIR/preparedev
-
-cd "$DIR/.."
-
-export LANG=us_US.UTF-8
-# Protect against proxy variable for dev
-unset http_proxy
-unset https_proxy
-
-
-"$DIR"/launch_scheduler_debug.sh
-"$DIR"/launch_poller_debug.sh
-"$DIR"/launch_reactionner_debug.sh
-"$DIR"/launch_broker_debug.sh
-"$DIR"/launch_receiver_debug.sh
-"$DIR"/launch_arbiter_debug.sh
diff --git a/dev/launch_arbiter.sh b/dev/launch_arbiter.sh
index 18ae6e8ff..0a261a124 100755
--- a/dev/launch_arbiter.sh
+++ b/dev/launch_arbiter.sh
@@ -1,4 +1,5 @@
-#!/bin/sh
+#!/bin/bash
+
#
# Copyright (C) 2015-2016: Alignak team, see AUTHORS.txt file for contributors
#
@@ -17,35 +18,10 @@
# You should have received a copy of the GNU Affero General Public License
# along with Alignak. If not, see .
#
-#
-# This file incorporates work covered by the following copyright and
-# permission notice:
-#
-# Copyright (C) 2009-2014:
-# Gabes Jean, naparuba@gmail.com
-# Gerhard Lausser, Gerhard.Lausser@consol.de
-# Gregory Starck, g.starck@gmail.com
-# Hartmut Goebel, h.goebel@goebel-consult.de
-#
-# This file is part of Shinken.
-#
-# Shinken is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# Shinken is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with Shinken. If not, see .
+DIR="$(cd $(dirname "$0"); pwd)"
+DAEMON_TYPE="ARBITER"
+DAEMON_NAME="${DAEMON_TYPE}_MASTER"
-DIR="$(cd $(dirname "$0"); pwd)"
-BIN="$DIR"/../alignak/bin
-ETC="$DIR"/../etc
+"$DIR/_launch_daemon.sh" $@ -a "$DAEMON_NAME"
-echo "Launching Arbiter (which reads configuration and dispatches it)"
-"$BIN"/alignak_arbiter.py -d -c "$ETC"/daemons/arbiterd.ini -a "$ETC"/alignak.cfg
diff --git a/dev/launch_arbiter_debug.sh b/dev/launch_arbiter_debug.sh
deleted file mode 100755
index bc58f7714..000000000
--- a/dev/launch_arbiter_debug.sh
+++ /dev/null
@@ -1,61 +0,0 @@
-#!/bin/sh
-#
-# Copyright (C) 2015-2016: Alignak team, see AUTHORS.txt file for contributors
-#
-# This file is part of Alignak.
-#
-# Alignak is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# Alignak is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with Alignak. If not, see .
-#
-#
-# This file incorporates work covered by the following copyright and
-# permission notice:
-#
-# Copyright (C) 2009-2014:
-# Gabes Jean, naparuba@gmail.com
-# Gerhard Lausser, Gerhard.Lausser@consol.de
-# Gregory Starck, g.starck@gmail.com
-# Hartmut Goebel, h.goebel@goebel-consult.de
-#
-# This file is part of Shinken.
-#
-# Shinken is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# Shinken is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with Shinken. If not, see .
-
-
-DIR="$(cd $(dirname "$0"); pwd)"
-BIN="$DIR"/../alignak/bin
-ETC="$DIR"/../etc
-DEBUG_PATH="/tmp/arbiter.debug"
-
-# Need to change directory to .../var because arbiter doesn't have a
-# default 'workdir' "properties" attribute:.
-cd /var/run/alignak
-
-echo "Launching Arbiter (which reads configuration and dispatches it) " \
- "in debug mode to the file $DEBUG_PATH"
-
-"$BIN"/alignak_arbiter.py -d \
- -c "$ETC"/daemons/arbiterd.ini\
- -a "$ETC"/alignak.cfg -a "$ETC"/sample/sample.cfg\
- --debug "$DEBUG_PATH" -p /tmp/arbiter.profile
diff --git a/dev/launch_broker.sh b/dev/launch_broker.sh
index 5e230c44f..a23bdd09f 100755
--- a/dev/launch_broker.sh
+++ b/dev/launch_broker.sh
@@ -1,4 +1,5 @@
-#!/bin/sh
+#!/bin/bash
+
#
# Copyright (C) 2015-2016: Alignak team, see AUTHORS.txt file for contributors
#
@@ -17,35 +18,10 @@
# You should have received a copy of the GNU Affero General Public License
# along with Alignak. If not, see .
#
-#
-# This file incorporates work covered by the following copyright and
-# permission notice:
-#
-# Copyright (C) 2009-2014:
-# Gabes Jean, naparuba@gmail.com
-# Gerhard Lausser, Gerhard.Lausser@consol.de
-# Gregory Starck, g.starck@gmail.com
-# Hartmut Goebel, h.goebel@goebel-consult.de
-#
-# This file is part of Shinken.
-#
-# Shinken is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# Shinken is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with Shinken. If not, see .
+DIR="$(cd $(dirname "$0"); pwd)"
+DAEMON_TYPE="BROKER"
+DAEMON_NAME="${DAEMON_TYPE}_MASTER"
-DIR="$(cd $(dirname "$0"); pwd)"
-BIN="$DIR"/../alignak/bin
-ETC="$DIR"/../etc
+"$DIR/_launch_daemon.sh" $@ "$DAEMON_NAME"
-echo "Launching Broker (which exports all data)"
-"$BIN"/alignak_broker.py -d -c "$ETC"/daemons/brokerd.ini
diff --git a/dev/launch_broker_debug.sh b/dev/launch_broker_debug.sh
deleted file mode 100755
index cfd6acb61..000000000
--- a/dev/launch_broker_debug.sh
+++ /dev/null
@@ -1,52 +0,0 @@
-#!/bin/sh
-#
-# Copyright (C) 2015-2016: Alignak team, see AUTHORS.txt file for contributors
-#
-# This file is part of Alignak.
-#
-# Alignak is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# Alignak is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with Alignak. If not, see .
-#
-#
-# This file incorporates work covered by the following copyright and
-# permission notice:
-#
-# Copyright (C) 2009-2014:
-# Gabes Jean, naparuba@gmail.com
-# Gerhard Lausser, Gerhard.Lausser@consol.de
-# Gregory Starck, g.starck@gmail.com
-# Hartmut Goebel, h.goebel@goebel-consult.de
-#
-# This file is part of Shinken.
-#
-# Shinken is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# Shinken is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with Shinken. If not, see .
-
-
-DIR="$(cd $(dirname "$0"); pwd)"
-BIN="$DIR"/../alignak/bin
-ETC="$DIR"/../etc
-DEBUG_PATH="/tmp/broker.debug"
-
-echo "Launching Broker (which exports all data) in debug mode to the file $DEBUG_PATH"
-"$BIN"/alignak_broker.py -d -c "$ETC"/daemons/brokerd.ini --debug "$DEBUG_PATH" --profile /tmp/broker.profile
diff --git a/dev/launch_poller.sh b/dev/launch_poller.sh
index ef47fbff5..58975b847 100755
--- a/dev/launch_poller.sh
+++ b/dev/launch_poller.sh
@@ -1,4 +1,5 @@
-#!/bin/sh
+#!/bin/bash
+
#
# Copyright (C) 2015-2016: Alignak team, see AUTHORS.txt file for contributors
#
@@ -17,35 +18,10 @@
# You should have received a copy of the GNU Affero General Public License
# along with Alignak. If not, see .
#
-#
-# This file incorporates work covered by the following copyright and
-# permission notice:
-#
-# Copyright (C) 2009-2014:
-# Gabes Jean, naparuba@gmail.com
-# Gerhard Lausser, Gerhard.Lausser@consol.de
-# Gregory Starck, g.starck@gmail.com
-# Hartmut Goebel, h.goebel@goebel-consult.de
-#
-# This file is part of Shinken.
-#
-# Shinken is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# Shinken is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with Shinken. If not, see .
+DIR="$(cd $(dirname "$0"); pwd)"
+DAEMON_TYPE="POLLER"
+DAEMON_NAME="${DAEMON_TYPE}_MASTER"
-DIR="$(cd $(dirname "$0"); pwd)"
-BIN="$DIR"/../alignak/bin
-ETC="$DIR"/../etc
+"$DIR/_launch_daemon.sh" $@ "$DAEMON_NAME"
-echo "Launching Poller (which launches checks)"
-"$BIN"/alignak_poller.py -d -c "$ETC"/daemons/pollerd.ini
diff --git a/dev/launch_poller_debug.sh b/dev/launch_poller_debug.sh
deleted file mode 100755
index 31daebff3..000000000
--- a/dev/launch_poller_debug.sh
+++ /dev/null
@@ -1,52 +0,0 @@
-#!/bin/sh
-#
-# Copyright (C) 2015-2016: Alignak team, see AUTHORS.txt file for contributors
-#
-# This file is part of Alignak.
-#
-# Alignak is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# Alignak is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with Alignak. If not, see .
-#
-#
-# This file incorporates work covered by the following copyright and
-# permission notice:
-#
-# Copyright (C) 2009-2014:
-# Gabes Jean, naparuba@gmail.com
-# Gerhard Lausser, Gerhard.Lausser@consol.de
-# Gregory Starck, g.starck@gmail.com
-# Hartmut Goebel, h.goebel@goebel-consult.de
-#
-# This file is part of Shinken.
-#
-# Shinken is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# Shinken is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with Shinken. If not, see .
-
-
-DIR="$(cd $(dirname "$0"); pwd)"
-BIN="$DIR"/../alignak/bin
-ETC="$DIR"/../etc
-DEBUG_PATH="/tmp/poller.debug"
-
-echo "Launching Poller (which launches checks) in debug mode to the file $DEBUG_PATH"
-"$BIN"/alignak_poller.py -d -c "$ETC"/daemons/pollerd.ini --debug "$DEBUG_PATH" --profile /tmp/poller.profile
diff --git a/dev/launch_reactionner.sh b/dev/launch_reactionner.sh
index e332c3b70..f546c7fcf 100755
--- a/dev/launch_reactionner.sh
+++ b/dev/launch_reactionner.sh
@@ -1,4 +1,5 @@
-#!/bin/sh
+#!/bin/bash
+
#
# Copyright (C) 2015-2016: Alignak team, see AUTHORS.txt file for contributors
#
@@ -17,35 +18,10 @@
# You should have received a copy of the GNU Affero General Public License
# along with Alignak. If not, see .
#
-#
-# This file incorporates work covered by the following copyright and
-# permission notice:
-#
-# Copyright (C) 2009-2014:
-# Gabes Jean, naparuba@gmail.com
-# Gerhard Lausser, Gerhard.Lausser@consol.de
-# Gregory Starck, g.starck@gmail.com
-# Hartmut Goebel, h.goebel@goebel-consult.de
-#
-# This file is part of Shinken.
-#
-# Shinken is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# Shinken is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with Shinken. If not, see .
+DIR="$(cd $(dirname "$0"); pwd)"
+DAEMON_TYPE="REACTIONNER"
+DAEMON_NAME="${DAEMON_TYPE}_MASTER"
-DIR="$(cd $(dirname "$0"); pwd)"
-BIN="$DIR"/../alignak/bin
-ETC="$DIR"/../etc
+"$DIR/_launch_daemon.sh" $@ "$DAEMON_NAME"
-echo "Launching Reactionner (which sends notifications)"
-"$BIN"/alignak_reactionner.py -d -c "$ETC"/daemons/reactionnerd.ini
diff --git a/dev/launch_reactionner_debug.sh b/dev/launch_reactionner_debug.sh
deleted file mode 100755
index 32507602f..000000000
--- a/dev/launch_reactionner_debug.sh
+++ /dev/null
@@ -1,52 +0,0 @@
-#!/bin/sh
-#
-# Copyright (C) 2015-2016: Alignak team, see AUTHORS.txt file for contributors
-#
-# This file is part of Alignak.
-#
-# Alignak is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# Alignak is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with Alignak. If not, see .
-#
-#
-# This file incorporates work covered by the following copyright and
-# permission notice:
-#
-# Copyright (C) 2009-2014:
-# Gabes Jean, naparuba@gmail.com
-# Gerhard Lausser, Gerhard.Lausser@consol.de
-# Gregory Starck, g.starck@gmail.com
-# Hartmut Goebel, h.goebel@goebel-consult.de
-#
-# This file is part of Shinken.
-#
-# Shinken is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# Shinken is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with Shinken. If not, see .
-
-
-DIR="$(cd $(dirname "$0"); pwd)"
-BIN="$DIR"/../alignak/bin
-ETC="$DIR"/../etc
-DEBUG_PATH="/tmp/reactionner.debug"
-
-echo "Launching Reactionner (which sends notifications) in debug mode to the file $DEBUG_PATH"
-"$BIN"/alignak_reactionner.py -d -c "$ETC"/daemons/reactionnerd.ini --debug "$DEBUG_PATH"
diff --git a/dev/launch_receiver.sh b/dev/launch_receiver.sh
index 80ce360dc..ee96bcdf9 100755
--- a/dev/launch_receiver.sh
+++ b/dev/launch_receiver.sh
@@ -1,4 +1,5 @@
-#!/bin/sh
+#!/bin/bash
+
#
# Copyright (C) 2015-2016: Alignak team, see AUTHORS.txt file for contributors
#
@@ -17,35 +18,10 @@
# You should have received a copy of the GNU Affero General Public License
# along with Alignak. If not, see .
#
-#
-# This file incorporates work covered by the following copyright and
-# permission notice:
-#
-# Copyright (C) 2009-2014:
-# Gabes Jean, naparuba@gmail.com
-# Gerhard Lausser, Gerhard.Lausser@consol.de
-# Gregory Starck, g.starck@gmail.com
-# Hartmut Goebel, h.goebel@goebel-consult.de
-#
-# This file is part of Shinken.
-#
-# Shinken is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# Shinken is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with Shinken. If not, see .
+DIR="$(cd $(dirname "$0"); pwd)"
+DAEMON_TYPE="RECEIVER"
+DAEMON_NAME="${DAEMON_TYPE}_MASTER"
-DIR="$(cd $(dirname "$0"); pwd)"
-BIN="$DIR"/../alignak/bin
-ETC="$DIR"/../etc
+"$DIR/_launch_daemon.sh" $@ "$DAEMON_NAME"
-echo "Launching Receiver (which manages passive data)"
-"$BIN"/alignak_receiver.py -d -c "$ETC"/daemons/receiverd.ini
diff --git a/dev/launch_receiver_debug.sh b/dev/launch_receiver_debug.sh
deleted file mode 100755
index f0283f11b..000000000
--- a/dev/launch_receiver_debug.sh
+++ /dev/null
@@ -1,52 +0,0 @@
-#!/bin/sh
-#
-# Copyright (C) 2015-2016: Alignak team, see AUTHORS.txt file for contributors
-#
-# This file is part of Alignak.
-#
-# Alignak is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# Alignak is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with Alignak. If not, see .
-#
-#
-# This file incorporates work covered by the following copyright and
-# permission notice:
-#
-# Copyright (C) 2009-2014:
-# Gabes Jean, naparuba@gmail.com
-# Gerhard Lausser, Gerhard.Lausser@consol.de
-# Gregory Starck, g.starck@gmail.com
-# Hartmut Goebel, h.goebel@goebel-consult.de
-#
-# This file is part of Shinken.
-#
-# Shinken is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# Shinken is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with Shinken. If not, see .
-
-
-DIR="$(cd $(dirname "$0"); pwd)"
-BIN="$DIR"/../alignak/bin
-ETC="$DIR"/../etc
-DEBUG_PATH="/tmp/receiver.debug"
-
-echo "Launching receiver (which manages passive data) in debug mode to the file $DEBUG_PATH"
-"$BIN"/alignak_receiver.py -d -c "$ETC"/daemons/receiverd.ini --debug "$DEBUG_PATH"
diff --git a/dev/launch_scheduler.sh b/dev/launch_scheduler.sh
index f967a0b14..c4a7a76f7 100755
--- a/dev/launch_scheduler.sh
+++ b/dev/launch_scheduler.sh
@@ -1,4 +1,5 @@
-#!/bin/sh
+#!/bin/bash
+
#
# Copyright (C) 2015-2016: Alignak team, see AUTHORS.txt file for contributors
#
@@ -17,35 +18,10 @@
# You should have received a copy of the GNU Affero General Public License
# along with Alignak. If not, see .
#
-#
-# This file incorporates work covered by the following copyright and
-# permission notice:
-#
-# Copyright (C) 2009-2014:
-# Gabes Jean, naparuba@gmail.com
-# Gerhard Lausser, Gerhard.Lausser@consol.de
-# Gregory Starck, g.starck@gmail.com
-# Hartmut Goebel, h.goebel@goebel-consult.de
-#
-# This file is part of Shinken.
-#
-# Shinken is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# Shinken is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with Shinken. If not, see .
+DIR="$(cd $(dirname "$0"); pwd)"
+DAEMON_TYPE="SCHEDULER"
+DAEMON_NAME="${DAEMON_TYPE}_MASTER"
-DIR="$(cd $(dirname "$0"); pwd)"
-BIN="$DIR"/../alignak/bin
-ETC="$DIR"/../etc
+"$DIR/_launch_daemon.sh" $@ "$DAEMON_NAME"
-echo "Launching Scheduler (that is only in charge of scheduling)"
-"$BIN"/alignak_scheduler.py -d -c "$ETC"/daemons/schedulerd.ini
diff --git a/dev/launch_scheduler_debug.sh b/dev/launch_scheduler_debug.sh
deleted file mode 100755
index c8b402304..000000000
--- a/dev/launch_scheduler_debug.sh
+++ /dev/null
@@ -1,52 +0,0 @@
-#!/bin/sh
-#
-# Copyright (C) 2015-2016: Alignak team, see AUTHORS.txt file for contributors
-#
-# This file is part of Alignak.
-#
-# Alignak is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# Alignak is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with Alignak. If not, see .
-#
-#
-# This file incorporates work covered by the following copyright and
-# permission notice:
-#
-# Copyright (C) 2009-2014:
-# Gabes Jean, naparuba@gmail.com
-# Gerhard Lausser, Gerhard.Lausser@consol.de
-# Gregory Starck, g.starck@gmail.com
-# Hartmut Goebel, h.goebel@goebel-consult.de
-#
-# This file is part of Shinken.
-#
-# Shinken is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# Shinken is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with Shinken. If not, see .
-
-
-DIR="$(cd $(dirname "$0"); pwd)"
-BIN="$DIR"/../alignak/bin
-ETC="$DIR"/../etc
-DEBUG_PATH="/tmp/scheduler.debug"
-
-echo "Launching Scheduler (that is only in charge of scheduling) in debug mode to the file $DEBUG_PATH"
-"$BIN"/alignak_scheduler.py -d -c "$ETC"/daemons/schedulerd.ini --debug "$DEBUG_PATH" --profile /tmp/scheduler.profile
diff --git a/dev/nagios b/dev/nagios
deleted file mode 100755
index c07610504..000000000
--- a/dev/nagios
+++ /dev/null
@@ -1,142 +0,0 @@
-#!/bin/bash
-#
-# Copyright (C) 2015-2016: Alignak team, see AUTHORS.txt file for contributors
-#
-# This file is part of Alignak.
-#
-# Alignak is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# Alignak is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with Alignak. If not, see .
-#
-#
-# This file incorporates work covered by the following copyright and
-# permission notice:
-#
-# Copyright (C) 2009-2014:
-# Gabes Jean, naparuba@gmail.com
-# Gerhard Lausser, Gerhard.Lausser@consol.de
-# Gregory Starck, g.starck@gmail.com
-# Hartmut Goebel, h.goebel@goebel-consult.de
-#
-# This file is part of Shinken.
-#
-# Shinken is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# Shinken is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with Shinken. If not, see .
-
-
-# Wrapper script to call Arbiter instead of Nagios bin
-DIR=$(dirname "$0")
-
-
-### find last python version
-versions="2.4 2.5 2.6 2.7"
-LASTFOUND=""
-# is there any python here?
-for v in $versions
-do
- which python$v > /dev/null 2>&1
- if [ $? -eq 0 ]
- then
- LASTFOUND="python$v"
- fi
-done
-
-if [ -z "$LASTFOUND" ]
-then
- # finaly try to find a default python
- which python > /dev/null 2>&1
- if [ $? -ne 0 ]
- then
- echo "No python interpreter found!"
- exit 2
- else
- echo "python found"
- LASTFOUND=$(which python)
- fi
-fi
-PY=$LASTFOUND
-
-
-### usage
-function usage(){
- echo "Alignak"
- echo "License: GNU AFFERO GENERAL PUBLIC LICENSE version 3"
- echo ""
- echo "Website: http://www.github.com/Alignak-monitoring/alignak"
- echo "Usage: nagios [options] "
- echo ""
- echo "Options:"
- echo ""
- echo " -v, --verify-config Verify all configuration data"
- echo " -s, --test-scheduling Not used "
- echo " -x, --dont-verify-paths Not used"
- echo " -p, --precache-objects Not used"
- echo " -u, --use-precached-objects Not used"
- echo " -d, --daemon Not used"
-}
-
-if [ -z "$1" ]; then
- usage
- exit 0
-fi
-
-
-### parse args
-COMMAND=""
-while getopts "v:sxpud" opt; do
- case $opt in
- v)
- COMMAND="$opt"
- ARG_OPT_v="$OPTARG"
- ;;
-
- s|x|p|u|d)
- # ignore unused options
- ;;
-
- *)
- usage
- exit 0
- ;;
- esac
-done
-shift $(( OPTIND - 1 ))
-
-
-### run commands
-case "$COMMAND" in
- v)
- if [ -z "$ARG_OPT_v" ]; then
- echo "You must provide a nagios configuration file"
- exit 2
- else
- # well alignak arbiter does not act really as nagios so we need to provide at least a -c argument for configfile
- $PY $DIR/alignak-arbiter.py -v -c $ARG_OPT_v
- exit $?
- fi
- ;;
-
- *)
- usage
- exit 0
- ;;
-esac
diff --git a/dev/restart_all.sh b/dev/restart_all.sh
index 84f4a5598..25ae9b95d 100755
--- a/dev/restart_all.sh
+++ b/dev/restart_all.sh
@@ -1,6 +1,29 @@
-#!/bin/sh
+#!/bin/bash
+#
+# Copyright (C) 2015-2016: Alignak team, see AUTHORS.txt file for contributors
+#
+# This file is part of Alignak.
+#
+# Alignak is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# Alignak is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with Alignak. If not, see .
+#
DIR="$(cd $(dirname "$0"); pwd)"
+
+#
+# Run this script with the -d parameter to restart all the daemons in debug mode
+#
+
"$DIR"/stop_all.sh
sleep 3
-"$DIR"/launch_all.sh
+"$DIR"/launch_all.sh $@
diff --git a/dev/restart_all_debug.sh b/dev/restart_all_debug.sh
deleted file mode 100755
index 900efe234..000000000
--- a/dev/restart_all_debug.sh
+++ /dev/null
@@ -1,6 +0,0 @@
-#!/bin/sh
-
-DIR="$(cd $(dirname "$0"); pwd)"
-"$DIR"/stop_all.sh
-sleep 3
-"$DIR"/launch_all_debug.sh
diff --git a/dev/stop_all.sh b/dev/stop_all.sh
index 4ab09ff8b..cd1e40d62 100755
--- a/dev/stop_all.sh
+++ b/dev/stop_all.sh
@@ -1,4 +1,5 @@
-#!/bin/sh
+#!/bin/bash
+
#
# Copyright (C) 2015-2016: Alignak team, see AUTHORS.txt file for contributors
#
@@ -17,38 +18,11 @@
# You should have received a copy of the GNU Affero General Public License
# along with Alignak. If not, see .
#
-#
-# This file incorporates work covered by the following copyright and
-# permission notice:
-#
-# Copyright (C) 2009-2014:
-# Gabes Jean, naparuba@gmail.com
-# Gerhard Lausser, Gerhard.Lausser@consol.de
-# Gregory Starck, g.starck@gmail.com
-# Hartmut Goebel, h.goebel@goebel-consult.de
-#
-# This file is part of Shinken.
-#
-# Shinken is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# Shinken is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with Shinken. If not, see .
-
-
DIR="$(cd $(dirname "$0"); pwd)"
-
+"$DIR"/stop_arbiter.sh
"$DIR"/stop_poller.sh
"$DIR"/stop_reactionner.sh
"$DIR"/stop_broker.sh
"$DIR"/stop_receiver.sh
"$DIR"/stop_scheduler.sh
-"$DIR"/stop_arbiter.sh
diff --git a/dev/stop_arbiter.sh b/dev/stop_arbiter.sh
index d3c15c330..065cbc24a 100755
--- a/dev/stop_arbiter.sh
+++ b/dev/stop_arbiter.sh
@@ -1,4 +1,5 @@
-#!/bin/sh
+#!/bin/bash
+
#
# Copyright (C) 2015-2016: Alignak team, see AUTHORS.txt file for contributors
#
@@ -17,35 +18,10 @@
# You should have received a copy of the GNU Affero General Public License
# along with Alignak. If not, see .
#
-#
-# This file incorporates work covered by the following copyright and
-# permission notice:
-#
-# Copyright (C) 2009-2014:
-# Gabes Jean, naparuba@gmail.com
-# Gerhard Lausser, Gerhard.Lausser@consol.de
-# Gregory Starck, g.starck@gmail.com
-# Hartmut Goebel, h.goebel@goebel-consult.de
-#
-# This file is part of Shinken.
-#
-# Shinken is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# Shinken is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with Shinken. If not, see .
+DIR="$(cd $(dirname "$0"); pwd)"
+DAEMON_TYPE="ARBITER"
+DAEMON_NAME="${DAEMON_TYPE}_MASTER"
-DIR="$(cd $(dirname "$0"); pwd)"
-BIN="$DIR"/../bin
-ETC="$DIR"/../etc
+"$DIR/_stop_daemon.sh" $@ "$DAEMON_NAME"
-echo "Stopping arbiter"
-kill $(cat /var/run/alignak/arbiterd.pid)
diff --git a/dev/stop_broker.sh b/dev/stop_broker.sh
index 127c10609..e3ba67d3b 100755
--- a/dev/stop_broker.sh
+++ b/dev/stop_broker.sh
@@ -1,4 +1,5 @@
-#!/bin/sh
+#!/bin/bash
+
#
# Copyright (C) 2015-2016: Alignak team, see AUTHORS.txt file for contributors
#
@@ -17,47 +18,10 @@
# You should have received a copy of the GNU Affero General Public License
# along with Alignak. If not, see .
#
-#
-# This file incorporates work covered by the following copyright and
-# permission notice:
-#
-# Copyright (C) 2009-2014:
-# Gabes Jean, naparuba@gmail.com
-# Gerhard Lausser, Gerhard.Lausser@consol.de
-# Gregory Starck, g.starck@gmail.com
-# Hartmut Goebel, h.goebel@goebel-consult.de
-#
-# This file is part of Shinken.
-#
-# Shinken is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# Shinken is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with Shinken. If not, see .
-
-
DIR="$(cd $(dirname "$0"); pwd)"
-BIN="$DIR"/../bin
-ETC="$DIR"/../etc
-
-echo "Stopping broker"
-
-parent=$(cat /var/run/alignak/brokerd.pid)
-kill $parent
-sleep 1
+DAEMON_TYPE="BROKER"
+DAEMON_NAME="${DAEMON_TYPE}_MASTER"
-# kill parent and childs broker processes
-for brokerpid in $(ps -f --ppid $parent | grep "alignak-broker" | awk '{print $2}')
-do
- echo "KILLING MODULE BROKER PROCESS" $brokerpid
- kill $brokerpid
-done
+"$DIR/_stop_daemon.sh" $@ "$DAEMON_NAME"
diff --git a/dev/stop_poller.sh b/dev/stop_poller.sh
index bd73276a9..a3f54f6d1 100755
--- a/dev/stop_poller.sh
+++ b/dev/stop_poller.sh
@@ -1,4 +1,5 @@
-#!/bin/sh
+#!/bin/bash
+
#
# Copyright (C) 2015-2016: Alignak team, see AUTHORS.txt file for contributors
#
@@ -17,35 +18,10 @@
# You should have received a copy of the GNU Affero General Public License
# along with Alignak. If not, see .
#
-#
-# This file incorporates work covered by the following copyright and
-# permission notice:
-#
-# Copyright (C) 2009-2014:
-# Gabes Jean, naparuba@gmail.com
-# Gerhard Lausser, Gerhard.Lausser@consol.de
-# Gregory Starck, g.starck@gmail.com
-# Hartmut Goebel, h.goebel@goebel-consult.de
-#
-# This file is part of Shinken.
-#
-# Shinken is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# Shinken is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with Shinken. If not, see .
+DIR="$(cd $(dirname "$0"); pwd)"
+DAEMON_TYPE="POLLER"
+DAEMON_NAME="${DAEMON_TYPE}_MASTER"
-DIR="$(cd $(dirname "$0"); pwd)"
-BIN="$DIR"/../bin
-ETC="$DIR"/../etc
+"$DIR/_stop_daemon.sh" $@ "$DAEMON_NAME"
-echo "Stopping poller"
-kill $(cat /var/run/alignak/pollerd.pid)
diff --git a/dev/stop_reactionner.sh b/dev/stop_reactionner.sh
index 9cb04fbf3..ec79fd997 100755
--- a/dev/stop_reactionner.sh
+++ b/dev/stop_reactionner.sh
@@ -1,4 +1,5 @@
-#!/bin/sh
+#!/bin/bash
+
#
# Copyright (C) 2015-2016: Alignak team, see AUTHORS.txt file for contributors
#
@@ -17,35 +18,10 @@
# You should have received a copy of the GNU Affero General Public License
# along with Alignak. If not, see .
#
-#
-# This file incorporates work covered by the following copyright and
-# permission notice:
-#
-# Copyright (C) 2009-2014:
-# Gabes Jean, naparuba@gmail.com
-# Gerhard Lausser, Gerhard.Lausser@consol.de
-# Gregory Starck, g.starck@gmail.com
-# Hartmut Goebel, h.goebel@goebel-consult.de
-#
-# This file is part of Shinken.
-#
-# Shinken is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# Shinken is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with Shinken. If not, see .
+DIR="$(cd $(dirname "$0"); pwd)"
+DAEMON_TYPE="REACTIONNER"
+DAEMON_NAME="${DAEMON_TYPE}_MASTER"
-DIR="$(cd $(dirname "$0"); pwd)"
-BIN="$DIR"/../bin
-ETC="$DIR"/../etc
+"$DIR/_stop_daemon.sh" $@ "$DAEMON_NAME"
-echo "Stopping reactionner"
-kill $(cat /var/run/alignak/reactionnerd.pid)
diff --git a/dev/stop_receiver.sh b/dev/stop_receiver.sh
index 1cd0ffc39..2c80c1a42 100755
--- a/dev/stop_receiver.sh
+++ b/dev/stop_receiver.sh
@@ -1,4 +1,5 @@
-#!/bin/sh
+#!/bin/bash
+
#
# Copyright (C) 2015-2016: Alignak team, see AUTHORS.txt file for contributors
#
@@ -17,35 +18,10 @@
# You should have received a copy of the GNU Affero General Public License
# along with Alignak. If not, see .
#
-#
-# This file incorporates work covered by the following copyright and
-# permission notice:
-#
-# Copyright (C) 2009-2014:
-# Gabes Jean, naparuba@gmail.com
-# Gerhard Lausser, Gerhard.Lausser@consol.de
-# Gregory Starck, g.starck@gmail.com
-# Hartmut Goebel, h.goebel@goebel-consult.de
-#
-# This file is part of Shinken.
-#
-# Shinken is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# Shinken is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with Shinken. If not, see .
+DIR="$(cd $(dirname "$0"); pwd)"
+DAEMON_TYPE="RECEIVER"
+DAEMON_NAME="${DAEMON_TYPE}_MASTER"
-DIR="$(cd $(dirname "$0"); pwd)"
-BIN="$DIR"/../bin
-ETC="$DIR"/../etc
+"$DIR/_stop_daemon.sh" $@ "$DAEMON_NAME"
-echo "Stopping receiver"
-kill $(cat /var/run/alignak/receiverd.pid)
diff --git a/dev/stop_scheduler.sh b/dev/stop_scheduler.sh
index 1aedbd979..0527428ff 100755
--- a/dev/stop_scheduler.sh
+++ b/dev/stop_scheduler.sh
@@ -1,4 +1,5 @@
-#!/bin/sh
+#!/bin/bash
+
#
# Copyright (C) 2015-2016: Alignak team, see AUTHORS.txt file for contributors
#
@@ -17,35 +18,10 @@
# You should have received a copy of the GNU Affero General Public License
# along with Alignak. If not, see .
#
-#
-# This file incorporates work covered by the following copyright and
-# permission notice:
-#
-# Copyright (C) 2009-2014:
-# Gabes Jean, naparuba@gmail.com
-# Gerhard Lausser, Gerhard.Lausser@consol.de
-# Gregory Starck, g.starck@gmail.com
-# Hartmut Goebel, h.goebel@goebel-consult.de
-#
-# This file is part of Shinken.
-#
-# Shinken is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# Shinken is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with Shinken. If not, see .
+DIR="$(cd $(dirname "$0"); pwd)"
+DAEMON_TYPE="SCHEDULER"
+DAEMON_NAME="${DAEMON_TYPE}_MASTER"
-DIR="$(cd $(dirname "$0"); pwd)"
-BIN="$DIR"/../bin
-ETC="$DIR"/../etc
+"$DIR/_stop_daemon.sh" $@ "$DAEMON_NAME"
-echo "Stopping scheduler"
-kill $(cat /var/run/alignak/schedulerd.pid)
diff --git a/etc/alignak.ini b/etc/alignak.ini
new file mode 100755
index 000000000..e26db5431
--- /dev/null
+++ b/etc/alignak.ini
@@ -0,0 +1,113 @@
+#
+# Copyright (C) 2015-2016: Alignak team, see AUTHORS.txt file for contributors
+#
+# This file is part of Alignak.
+#
+# Alignak is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# Alignak is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with Alignak. If not, see .
+#
+
+#
+# This configuration file is the main Alignak configuration entry point. Each Alignak installer
+# will adapt the content of this file according to the installation process. This will allow
+# any Alignak extension or third party application to find where the Alignak components and
+# files are located on the system.
+#
+# ---
+# This version of the file contains variable that are suitable to run a single node Alignak
+# with all its daemon using the default configuration existing in the repository.
+#
+
+# Main alignak variables:
+# - BIN is where the launch scripts are located
+# (Debian sets to /usr/bin)
+# - ETC is where we store the configuration files
+# (Debian sets to /etc/alignak)
+# - VAR is where the libraries and plugins files are installed
+# (Debian sets to /var/lib/alignak)
+# - RUN is the daemons working directory and where pid files are stored
+# (Debian sets to /var/run/alignak)
+# - LOG is where we put log files
+# (Debian sets to /var/log/alignak)
+#
+[DEFAULT]
+BIN=../alignak/bin
+ETC=../etc
+VAR=/tmp
+RUN=/tmp
+LOG=/tmp
+
+
+# We define the name of the 2 main Alignak configuration files.
+# There may be 2 configuration files because tools like Centreon generate those...
+[alignak-configuration]
+# Alignak main configuration file
+CFG=%(ETC)s/alignak.cfg
+# Alignak secondary configuration file (none as a default)
+SPECIFICCFG=
+
+
+# For each Alignak daemon, this file contains a section with the daemon name. The section
+# identifier is the corresponding daemon name. This daemon name is built with the daemon
+# type (eg. arbiter, poller,...) and the daemon name separated with a dash.
+# This rule ensure that alignak will be able to find all the daemons configuration in this
+# whatever the number of daemons existing in the configuration
+#
+# Each section defines:
+# - the location of the daemon configuration file
+# - the daemon launching script
+# - the location of the daemon pid file
+# - the location of the daemon debug log file (if any is to be used)
+
+[arbiter-master]
+### ARBITER PART ###
+PROCESS=alignak-arbiter
+DAEMON=%(BIN)s/alignak_arbiter.py
+CFG=%(ETC)s/daemons/arbiterd.ini
+DEBUGFILE=%(LOG)s/arbiter-debug.log
+
+
+[scheduler-master]
+### SCHEDULER PART ###
+PROCESS=alignak-scheduler
+DAEMON=%(BIN)s/alignak_scheduler.py
+CFG=%(ETC)s/daemons/schedulerd.ini
+DEBUGFILE=%(LOG)s/scheduler-debug.log
+
+[poller-master]
+### POLLER PART ###
+PROCESS=alignak-poller
+DAEMON=%(BIN)s/alignak_poller.py
+CFG=%(ETC)s/daemons/pollerd.ini
+DEBUGFILE=%(LOG)s/poller-debug.log
+
+[reactionner-master]
+### REACTIONNER PART ###
+PROCESS=alignak-reactionner
+DAEMON=%(BIN)s/alignak_reactionner.py
+CFG=%(ETC)s/daemons/reactionnerd.ini
+DEBUGFILE=%(LOG)s/reactionner-debug.log
+
+[broker-master]
+### BROKER PART ###
+PROCESS=alignak-broker
+DAEMON=%(BIN)s/alignak_broker.py
+CFG=%(ETC)s/daemons/brokerd.ini
+DEBUGFILE=%(LOG)s/broker-debug.log
+
+[receiver-master]
+### RECEIVER PART ###
+PROCESS=alignak-receiver
+DAEMON=%(BIN)s/alignak_receiver.py
+CFG=%(ETC)s/daemons/receiverd.ini
+DEBUGFILE=%(LOG)s/receiver-debug.log
diff --git a/etc/arbiter/daemons/broker-master.cfg b/etc/arbiter/daemons/broker-master.cfg
index ea878a496..3e71c6ec3 100644
--- a/etc/arbiter/daemons/broker-master.cfg
+++ b/etc/arbiter/daemons/broker-master.cfg
@@ -24,7 +24,8 @@ define broker {
# Default: None
# Interesting modules that can be used:
# - backend_broker = update the live state in the Alignak backend
- modules
+ # - logs = collect monitoring logs and send them to a Python logger
+ #modules backend_broker
## Optional parameters:
timeout 3 ; Ping timeout
diff --git a/etc/arbiter/daemons/poller-master.cfg b/etc/arbiter/daemons/poller-master.cfg
index 7251ae8fd..691cd1496 100644
--- a/etc/arbiter/daemons/poller-master.cfg
+++ b/etc/arbiter/daemons/poller-master.cfg
@@ -17,9 +17,7 @@ define poller {
## Modules
# Default: None
## Interesting modules:
- # - nrpe-booster = Replaces the check_nrpe binary. Therefore it
- # enhances performances when there are lot of NRPE
- # calls.
+ # - nrpe-booster = Replaces the check_nrpe binary to enhance performance for NRPE checks
# - snmp-booster = Snmp bulk polling module
modules
diff --git a/etc/arbiter/resource.d/paths.cfg b/etc/arbiter/resource.d/paths.cfg
index 2be9e590c..e754216c5 100644
--- a/etc/arbiter/resource.d/paths.cfg
+++ b/etc/arbiter/resource.d/paths.cfg
@@ -2,6 +2,12 @@
$USER1$=$NAGIOSPLUGINSDIR$
$NAGIOSPLUGINSDIR$=/usr/lib/nagios/plugins
-#-- Location of the plugins for Alignak
-$PLUGINSDIR$=/usr/local/var/libexec/alignak
-
+#-- Alignak main directories
+#-- Those variables are automatically updated during the Alignak installation
+#-- process (eg. python setup.py install)
+$ETC$=/usr/local/alignak/etc
+$VAR$=/tmp
+$RUN$=$VAR$/run
+$LOG$=$VAR$/log
+$LIBEXEC$=$VAR$/libexec
+$PLUGINSDIR$=$LIBEXEC$
diff --git a/etc/daemons/arbiterd.ini b/etc/daemons/arbiterd.ini
index 543c0ef67..404573e4a 100755
--- a/etc/daemons/arbiterd.ini
+++ b/etc/daemons/arbiterd.ini
@@ -7,6 +7,10 @@ workdir=/usr/local/var/run/alignak
logdir=/usr/local/var/log/alignak
etcdir=/usr/local/etc/alignak
+#-- Note that those variables:
+# 1/ are used in this file as %(workdir)s
+# 2/ are automatically updated during the Alignak installation process (eg. python setup.py install)
+
# The daemon will chdir into the directory workdir when launched
# It will create its pid file in the working dir
pidfile=%(workdir)s/arbiterd.pid
diff --git a/etc/daemons/brokerd.ini b/etc/daemons/brokerd.ini
index 126a873e5..b998a38ae 100755
--- a/etc/daemons/brokerd.ini
+++ b/etc/daemons/brokerd.ini
@@ -7,6 +7,10 @@ workdir=/usr/local/var/run/alignak
logdir=/usr/local/var/log/alignak
etcdir=/usr/local/etc/alignak
+#-- Note that those variables:
+# 1/ are used in this file as %(workdir)s
+# 2/ are automatically updated during the Alignak installation process (eg. python setup.py install)
+
# The daemon will chdir into the directory workdir when launched
# It will create its pid file in the working dir
pidfile=%(workdir)s/brokerd.pid
diff --git a/etc/daemons/pollerd.ini b/etc/daemons/pollerd.ini
index a468e9f2f..13abd7434 100755
--- a/etc/daemons/pollerd.ini
+++ b/etc/daemons/pollerd.ini
@@ -7,6 +7,10 @@ workdir=/usr/local/var/run/alignak
logdir=/usr/local/var/log/alignak
etcdir=/usr/local/etc/alignak
+#-- Note that those variables:
+# 1/ are used in this file as %(workdir)s
+# 2/ are automatically updated during the Alignak installation process (eg. python setup.py install)
+
# The daemon will chdir into the directory workdir when launched
# It will create its pid file in the working dir
pidfile=%(workdir)s/pollerd.pid
diff --git a/etc/daemons/reactionnerd.ini b/etc/daemons/reactionnerd.ini
index 891510b67..0a287534c 100755
--- a/etc/daemons/reactionnerd.ini
+++ b/etc/daemons/reactionnerd.ini
@@ -7,6 +7,10 @@ workdir=/usr/local/var/run/alignak
logdir=/usr/local/var/log/alignak
etcdir=/usr/local/etc/alignak
+#-- Note that those variables:
+# 1/ are used in this file as %(workdir)s
+# 2/ are automatically updated during the Alignak installation process (eg. python setup.py install)
+
# The daemon will chdir into the directory workdir when launched
# It will create its pid file in the working dir
pidfile=%(workdir)s/reactionnerd.pid
diff --git a/etc/daemons/receiverd.ini b/etc/daemons/receiverd.ini
index 0f4d41cc3..9ead58ecd 100755
--- a/etc/daemons/receiverd.ini
+++ b/etc/daemons/receiverd.ini
@@ -7,6 +7,10 @@ workdir=/usr/local/var/run/alignak
logdir=/usr/local/var/log/alignak
etcdir=/usr/local/etc/alignak
+#-- Note that those variables:
+# 1/ are used in this file as %(workdir)s
+# 2/ are automatically updated during the Alignak installation process (eg. python setup.py install)
+
# The daemon will chdir into the directory workdir when launched
# It will create its pid file in the working dir
pidfile=%(workdir)s/receiverd.pid
diff --git a/etc/daemons/schedulerd.ini b/etc/daemons/schedulerd.ini
index 1af84d1f9..a574d36c7 100755
--- a/etc/daemons/schedulerd.ini
+++ b/etc/daemons/schedulerd.ini
@@ -7,6 +7,10 @@ workdir=/usr/local/var/run/alignak
logdir=/usr/local/var/log/alignak
etcdir=/usr/local/etc/alignak
+#-- Note that those variables:
+# 1/ are used in this file as %(workdir)s
+# 2/ are automatically updated during the Alignak installation process (eg. python setup.py install)
+
# The daemon will chdir into the directory workdir when launched
# It will create its pid file in the working dir
pidfile=%(workdir)s/schedulerd.pid
diff --git a/install_hooks.py b/install_hooks.py
index 5d45d9ba5..ed12c6f44 100755
--- a/install_hooks.py
+++ b/install_hooks.py
@@ -2,6 +2,7 @@
# -*- coding: utf-8 -*-
import os
+import shutil
import sys
import re
import fileinput
@@ -49,12 +50,20 @@ def get_init_scripts(config):
"""
data_files = config['files']['data_files']
if 'win' in sys.platform:
- pass
+ raise Exception("Not yet Windows ready, sorry. For more information, "
+ "see: https://github.com/Alignak-monitoring/alignak/issues/522")
elif 'linux' in sys.platform or 'sunos5' in sys.platform:
- data_files = data_files + "\netc/init.d = bin/init.d/*"
- data_files = data_files + "\netc/default = bin/default/alignak.in"
+ # Perhaps we may completely remove this @Seb-Solon? init.d scripts moved to packaging repo
+ print("Linux: %s" % sys.platform)
+ # data_files = data_files + "\nalignak/bin/etc/init.d = systemV/init.d/*"
+ # data_files = data_files + "\nalignak/bin/etc/default = systemV/default/alignak.in"
+ # data_files = data_files + "\nalignak/etc = systemV/alignak.ini"
elif 'bsd' in sys.platform or 'dragonfly' in sys.platform:
- data_files = data_files + "\netc/rc.d = bin/rc.d/*"
+ # Perhaps we may completely remove this @Seb-Solon? rc.d scripts moved to packaging repo
+ print("Unix: %s" % sys.platform)
+ # data_files = data_files + "\nalignak/bin/etc/rc.d = for_freebsd/rc.d/*"
+ # # data_files = data_files + "\nalignak/bin/etc/default = for_freebsd/default/alignak.in"
+ # data_files = data_files + "\nalignak/etc = for_freebsd/alignak.ini"
else:
raise Exception("Unsupported platform, sorry")
@@ -73,209 +82,132 @@ def fix_alignak_cfg(config):
:param config:
:return:
"""
- default_paths = {
- 'workdir': '/var/run/alignak',
- 'logdir': '/var/log/alignak',
- # TODO: confirm is is unuseful...
- 'modules_dir': '/var/lib/alignak/modules',
- 'plugins_dir': '/var/libexec/alignak',
-
- 'lock_file': '/var/run/alignak/arbiterd.pid',
- 'local_log': '/var/log/alignak/arbiterd.log',
- 'pidfile': '/var/run/alignak/arbiterd.pid',
-
- 'pack_distribution_file': '/var/lib/alignak/pack_distribution.dat'
- }
- default_macros = {
- 'LOGSDIR': '/var/log/alignak',
- 'PLUGINSDIR': '/var/libexec/alignak',
- }
-
- default_ssl = {
- 'ca_cert': '/etc/alignak/certs/ca.pem',
- 'server_cert': '/etc/alignak/certs/server.cert',
- 'server_key': '/etc/alignak/certs/server.key',
+ """
+ Default Alignak configuration and directories are defined as is:
+ """
+ alignak_cfg = {
+ 'USER': 'alignak',
+ 'GROUP': 'alignak',
+ 'BIN': '/bin',
+ 'ETC': '/etc/alignak',
+ 'VAR': '/var/libexec/alignak',
+ 'RUN': '/var/run/alignak',
+ 'LOG': '/var/log/alignak'
}
-
- # Changing default user/group if root
- default_users = {}
- if getpass.getuser() == 'root':
- default_users['alignak_user'] = 'alignak'
- default_users['alignak_group'] = 'alignak'
- default_users['user'] = 'alignak'
- default_users['group'] = 'alignak'
- default_users['ALIGNAKUSER'] = 'alignak'
- default_users['ALIGNAKGROUP'] = 'alignak'
- default_users['HOME'] = '`getent passwd "$ALIGNAKUSER" | cut -d: -f 6`'
-
- # Prepare pattern for alignak.cfg
- pattern = "|".join(default_paths.keys())
+ pattern = "|".join(alignak_cfg.keys())
+ # Search from start of line something like ETC=qsdqsdqsd
changing_path = re.compile("^(%s) *= *" % pattern)
- pattern = "|".join(default_users.keys())
- changing_user = re.compile("^#(%s) *= *" % pattern)
- pattern = "|".join(default_ssl.keys())
- changing_ssl = re.compile("^#(%s) *= *" % pattern)
- pattern = "|".join(default_macros.keys())
- changing_mac = re.compile(r"^\$(%s)\$ *= *" % pattern)
-
- # Fix resource paths
- alignak_file = os.path.join(
- config.install_dir, "etc", "alignak", "arbiter", "resource.d", "paths.cfg"
- )
- if not os.path.exists(alignak_file):
- print(
- "\n"
- "================================================================================\n"
- "== The configuration file '%s' is missing. ==\n"
- "================================================================================\n"
- % alignak_file
- )
- for line in fileinput.input(alignak_file, inplace=True):
- line = line.strip()
- mac_attr_name = changing_mac.match(line)
- if mac_attr_name:
- new_path = os.path.join(config.install_dir,
- default_macros[mac_attr_name.group(1)].strip("/"))
- print("$%s$=%s" % (mac_attr_name.group(1),
- new_path))
- else:
- print(line)
-
- # Fix alignak.cfg
- alignak_file = os.path.join(config.install_dir, "etc", "alignak", "alignak.cfg")
- if not os.path.exists(alignak_file):
- print(
- "\n"
- "================================================================================\n"
- "== The configuration file '%s' is missing. ==\n"
- "================================================================================\n"
- % alignak_file
- )
-
- for line in fileinput.input(alignak_file, inplace=True):
- line = line.strip()
- path_attr_name = changing_path.match(line)
- user_attr_name = changing_user.match(line)
- ssl_attr_name = changing_ssl.match(line)
- if path_attr_name:
- new_path = os.path.join(config.install_dir,
- default_paths[path_attr_name.group(1)].strip("/"))
- print("%s=%s" % (path_attr_name.group(1),
- new_path))
- elif user_attr_name:
- print("#%s=%s" % (user_attr_name.group(1),
- default_users[user_attr_name.group(1)]))
- elif ssl_attr_name:
- new_path = os.path.join(config.install_dir,
- default_ssl[ssl_attr_name.group(1)].strip("/"))
- print("#%s=%s" % (ssl_attr_name.group(1),
- new_path))
- else:
- print(line)
-
- # Handle daemons ini files
- for ini_file in ["arbiterd.ini", "brokerd.ini", "schedulerd.ini",
- "pollerd.ini", "reactionnerd.ini", "receiverd.ini"]:
- # Prepare pattern for ini files
- daemon_name = ini_file.replace(".ini", "")
- default_paths['lock_file'] = '/var/run/alignak/%s.pid' % daemon_name
- default_paths['local_log'] = '/var/log/alignak/%s.log' % daemon_name
- default_paths['pidfile'] = '/var/run/alignak/%s.pid' % daemon_name
- pattern = "|".join(default_paths.keys())
- changing_path = re.compile("^(%s) *= *" % pattern)
+ # Read main Alignak configuration file (eg. /etc/default/alignak)
+ cfg_file_name = os.path.join(config.install_dir, "alignak", "bin", "etc", "default", "alignak.in")
+ if os.path.exists(cfg_file_name):
+ print("Alignak shell configuration file is: %s" % cfg_file_name)
+ for line in open(cfg_file_name):
+ line = line.strip()
+ print("Line: %s" % line)
+ got_path = changing_path.match(line)
+ if got_path:
+ found = got_path.group(1)
+ alignak_cfg[found] = os.path.join(
+ config.install_dir, alignak_cfg[found].strip("/")
+ )
+ else:
+ print("Alignak shell configuration file not found: %s" % cfg_file_name)
+ for path in alignak_cfg:
+ if path not in ['USER', 'GROUP']:
+ alignak_cfg[path] = os.path.join(
+ config.install_dir, alignak_cfg[path].strip("/")
+ )
- # Fix ini file
- alignak_file = os.path.join(config.install_dir, "etc", "alignak", "daemons", ini_file)
- if not os.path.exists(alignak_file):
- print(
- "\n"
- "================================================================================\n"
- "== The configuration file '%s' is missing. ==\n"
- "================================================================================\n"
- % alignak_file
- )
+ print("\n"
+ "===================================================="
+ "====================================================")
+ print("Alignak installation directory: %s" % config.install_dir)
+ print("===================================================="
+ "====================================================\n")
- for line in fileinput.input(alignak_file, inplace=True):
- line = line.strip()
- path_attr_name = changing_path.match(line)
- user_attr_name = changing_user.match(line)
- ssl_attr_name = changing_ssl.match(line)
- if path_attr_name:
- new_path = os.path.join(config.install_dir,
- default_paths[path_attr_name.group(1)].strip("/"))
- print("%s=%s" % (path_attr_name.group(1),
- new_path))
- elif user_attr_name:
- print("#%s=%s" % (user_attr_name.group(1),
- default_users[user_attr_name.group(1)]))
- elif ssl_attr_name:
- new_path = os.path.join(config.install_dir,
- default_ssl[ssl_attr_name.group(1)].strip("/"))
- print("#%s=%s" % (ssl_attr_name.group(1),
- new_path))
- else:
- print(line)
+ print("\n"
+ "===================================================="
+ "====================================================")
+ print("Alignak main configuration directories: ")
+ for path in alignak_cfg:
+ if path not in ['USER', 'GROUP']:
+ print(" %s = %s" % (path, alignak_cfg[path]))
+ print("===================================================="
+ "====================================================\n")
- # Handle default/alignak
- if 'linux' in sys.platform or 'sunos5' in sys.platform:
- old_name = os.path.join(config.install_dir, "etc", "default", "alignak.in")
- if not os.path.exists(old_name):
- print("\n"
- "=======================================================================================================\n"
- "== The configuration file '%s' is missing.\n"
- "=======================================================================================================\n"
- % alignak_file)
+ """
+ Update resource files
+ - get all .cfg files in the arbiter/resource.d folder
+ - update the $LOG$=, $ETC$=,... macros with the real installation paths
+ """
+ pattern = "|".join(alignak_cfg.keys())
+ # Search from start of line something like ETC=qsdqsdqsd
+ changing_path = re.compile("^(%s) *= *" % pattern)
- new_name = os.path.join(config.install_dir, "etc", "default", "alignak")
- try:
- os.rename(old_name, new_name)
- except OSError as e:
- print("\n"
- "=======================================================================================================\n"
- "== The configuration file '%s' could not be renamed to '%s'.\n"
- "== The newly installed configuration will not be up-to-date.\n"
- "=======================================================================================================\n"
- % (old_name, new_name))
+ resource_folder = os.path.join(alignak_cfg["ETC"], "arbiter", "resource.d")
+ for _, _, files in os.walk(resource_folder):
+ for r_file in files:
+ if not re.search(r"\.cfg$", r_file):
+ continue
+
+ # Handle resource paths file
+ resource_file = os.path.join(resource_folder, r_file)
+ for line in fileinput.input(resource_file, inplace=True):
+ line = line.strip()
+ got_path = changing_path.match(line)
+ if got_path:
+ print("%s=%s" % (got_path.group(1), alignak_cfg[got_path.group(1)]))
+ else:
+ print(line)
- default_paths = {
- 'ETC': '/etc/alignak',
- 'VAR': '/var/lib/alignak',
- 'BIN': '/bin',
- 'RUN': '/var/run/alignak',
- 'LOG': '/var/log/alignak',
- 'LIB': '/var/libexec/alignak',
- }
- pattern = "|".join(default_paths.keys())
- changing_path = re.compile("^(%s) *= *" % pattern)
- for line in fileinput.input(new_name, inplace=True):
- line = line.strip()
- path_attr_name = changing_path.match(line)
- user_attr_name = changing_user.match(line)
- if path_attr_name:
- new_path = os.path.join(config.install_dir,
- default_paths[path_attr_name.group(1)].strip("/"))
- print("%s=%s" % (path_attr_name.group(1),
- new_path))
- elif user_attr_name:
- print("#%s=%s" % (user_attr_name.group(1),
- default_users[user_attr_name.group(1)]))
+ """
+ Update daemons configuration files
+ - get all .ini files in the arbiter/daemons folder
+ - update the workdir, logdir and etcdir variables with the real installation paths
+ """
+ default_paths = {
+ 'workdir': 'RUN',
+ 'logdir': 'LOG',
+ 'etcdir': 'ETC'
+ }
+ pattern = "|".join(default_paths.keys())
+ changing_path = re.compile("^(%s) *= *" % pattern)
- else:
- print(line)
+ daemons_folder = os.path.join(alignak_cfg["ETC"], "daemons")
+ for _, _, files in os.walk(daemons_folder):
+ for d_file in files:
+ if not re.search(r"\.ini", d_file):
+ continue
+
+ # Handle daemon configuration file
+ daemon_file = os.path.join(daemons_folder, d_file)
+ for line in fileinput.input(daemon_file, inplace=True):
+ line = line.strip()
+ got_path = changing_path.match(line)
+ if got_path:
+ print("%s=%s" % (got_path.group(1), alignak_cfg[default_paths[got_path.group(1)]]))
+ else:
+ print(line)
- # Alignak run script
- alignak_run = ''
- if 'win' in sys.platform:
- pass
- elif 'linux' in sys.platform or 'sunos5' in sys.platform:
- alignak_run = os.path.join(config.install_dir, "etc", "init.d", "alignak start")
- elif 'bsd' in sys.platform or 'dragonfly' in sys.platform:
- alignak_run = os.path.join(config.install_dir, "etc", "rc.d", "alignak start")
+ """
+ Get default run scripts and configuration location
+ """
+ # # Alignak run script
+ # alignak_run = ''
+ # if 'win' in sys.platform:
+ # raise Exception("Not yet Windows ready, sorry. For more information, "
+ # "see: https://github.com/Alignak-monitoring/alignak/issues/522")
+ # elif 'linux' in sys.platform or 'sunos5' in sys.platform:
+ # alignak_run = os.path.join(config.install_dir,
+ # "alignak", "bin", "etc", "init.d", "alignak start")
+ # elif 'bsd' in sys.platform or 'dragonfly' in sys.platform:
+ # alignak_run = os.path.join(config.install_dir,
+ # "alignak", "bin", "etc", "rc.d", "alignak start")
# Alignak configuration root directory
- alignak_etc = os.path.join(config.install_dir, "etc", "alignak")
+ alignak_etc = alignak_cfg["ETC"]
# Add ENV vars only if we are in virtualenv
# in order to get init scripts working
@@ -312,8 +244,7 @@ def fix_alignak_cfg(config):
"== ==\n"
"== -------------------------------------------------------------------------- ==\n"
"== ==\n"
- "== You can run Alignak with: ==\n"
- "== %s\n"
+ "== You can run Alignak with the scripts located in the dev folder. ==\n"
"== ==\n"
"== The default installed configuration is located here: ==\n"
"== %s\n"
@@ -330,9 +261,8 @@ def fix_alignak_cfg(config):
"== -------------------------------------------------------------------------- ==\n"
"== ==\n"
"== You should also grant ownership on those directories to the user alignak: ==\n"
- "== chown -R alignak:alignak /usr/local/var/run/alignak ==\n"
- "== chown -R alignak:alignak /usr/local/var/log/alignak ==\n"
- "== chown -R alignak:alignak /usr/local/var/libexec/alignak ==\n"
+ "== chown -R alignak:alignak %s\n"
+ "== chown -R alignak:alignak %s\n"
"== ==\n"
"== -------------------------------------------------------------------------- ==\n"
"== ==\n"
@@ -342,7 +272,7 @@ def fix_alignak_cfg(config):
"== http://alignak-monitoring.github.io/download/ ==\n"
"== ==\n"
"================================================================================\n"
- % (alignak_run, alignak_etc, alignak_etc, alignak_etc)
+ % (alignak_etc, alignak_etc, alignak_etc, alignak_cfg["LOG"], alignak_cfg["VAR"])
)
# Check Alignak recommended user existence
diff --git a/requirements.txt b/requirements.txt
index a39801e3d..09b1e6be2 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -4,7 +4,6 @@
CherryPy
requests>=2.7.0
importlib
-pbr
termcolor==1.1.0
setproctitle
ujson