Skip to content

Commit

Permalink
Fixes #715: update start/stop dev scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
mohierf committed Jan 29, 2017
1 parent e1a0371 commit a9cd430
Show file tree
Hide file tree
Showing 15 changed files with 101 additions and 25 deletions.
3 changes: 2 additions & 1 deletion dev/_launch_daemon.sh
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ echo "---"

# 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"

Expand All @@ -130,7 +131,7 @@ while IFS=';' read -ra VAR; do
for v in "${VAR[@]}"; do
eval "$v"
done
done <<< "$($DIR/../alignak/bin/alignak_environment.py $DIR/../etc/alignak.ini)"
done <<< "$(alignak-environment $ALIGNAK_CONFIGURATION_INI)"

if [ ${ALIGNAKCFG} ]; then
echo "Alignak main configuration file is defined in the environment"
Expand Down
23 changes: 22 additions & 1 deletion dev/_stop_daemon.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,27 @@ fi

DAEMON_NAME="$1"

# Alignak.ini file name
echo "---"
if [ ${ALIGNAKINI} ]; then
echo "Alignak ini configuration file is defined in the environment"
ALIGNAK_CONFIGURATION_INI="$ALIGNAKINI"
else
if [ -f "/usr/local/etc/alignak/alignak.ini" ]; then
echo "Alignak ini configuration file found in /usr/local/etc/alignak folder"
ALIGNAK_CONFIGURATION_INI="/usr/local/etc/alignak/alignak.ini"
else
if [ -f "/etc/alignak/alignak.ini" ]; then
echo "Alignak ini configuration file found in /etc/alignak folder"
ALIGNAK_CONFIGURATION_INI="/etc/alignak/alignak.ini"
else
ALIGNAK_CONFIGURATION_INI="$DIR/../etc/alignak.ini"
fi
fi
fi
echo "Alignak ini configuration file: $ALIGNAK_CONFIGURATION_INI"
echo "---"

# Get the daemon's variables names (only the name, not the value)
scr_var="${DAEMON_NAME}_DAEMON"
proc_var="${DAEMON_NAME}_PROCESS"
Expand All @@ -46,7 +67,7 @@ while IFS=';' read -ra VAR; do
for v in "${VAR[@]}"; do
eval "$v"
done
done <<< "$($DIR/../alignak/bin/alignak_environment.py ../etc/alignak.ini)"
done <<< "$(alignak-environment $ALIGNAK_CONFIGURATION_INI)"


echo "---"
Expand Down
7 changes: 6 additions & 1 deletion dev/launch_arbiter.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,12 @@
DIR="$(cd $(dirname "$0"); pwd)"

DAEMON_TYPE="ARBITER"
DAEMON_NAME="${DAEMON_TYPE}_MASTER"
if [ $# -eq 0 ]; then
DAEMON_NAME="${DAEMON_TYPE}_MASTER"
else
# Make parameter as uppercase for daemon name
DAEMON_NAME="${DAEMON_TYPE}_${1^^}"
fi

"$DIR/_launch_daemon.sh" $@ -a "$DAEMON_NAME"

7 changes: 6 additions & 1 deletion dev/launch_broker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,12 @@
DIR="$(cd $(dirname "$0"); pwd)"

DAEMON_TYPE="BROKER"
DAEMON_NAME="${DAEMON_TYPE}_MASTER"
if [ $# -eq 0 ]; then
DAEMON_NAME="${DAEMON_TYPE}_MASTER"
else
# Make parameter as uppercase for daemon name
DAEMON_NAME="${DAEMON_TYPE}_${1^^}"
fi

"$DIR/_launch_daemon.sh" $@ "$DAEMON_NAME"

7 changes: 6 additions & 1 deletion dev/launch_poller.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,12 @@
DIR="$(cd $(dirname "$0"); pwd)"

DAEMON_TYPE="POLLER"
DAEMON_NAME="${DAEMON_TYPE}_MASTER"
if [ $# -eq 0 ]; then
DAEMON_NAME="${DAEMON_TYPE}_MASTER"
else
# Make parameter as uppercase for daemon name
DAEMON_NAME="${DAEMON_TYPE}_${1^^}"
fi

"$DIR/_launch_daemon.sh" $@ "$DAEMON_NAME"

7 changes: 6 additions & 1 deletion dev/launch_reactionner.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,12 @@
DIR="$(cd $(dirname "$0"); pwd)"

DAEMON_TYPE="REACTIONNER"
DAEMON_NAME="${DAEMON_TYPE}_MASTER"
if [ $# -eq 0 ]; then
DAEMON_NAME="${DAEMON_TYPE}_MASTER"
else
# Make parameter as uppercase for daemon name
DAEMON_NAME="${DAEMON_TYPE}_${1^^}"
fi

"$DIR/_launch_daemon.sh" $@ "$DAEMON_NAME"

7 changes: 6 additions & 1 deletion dev/launch_receiver.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,12 @@
DIR="$(cd $(dirname "$0"); pwd)"

DAEMON_TYPE="RECEIVER"
DAEMON_NAME="${DAEMON_TYPE}_MASTER"
if [ $# -eq 0 ]; then
DAEMON_NAME="${DAEMON_TYPE}_MASTER"
else
# Make parameter as uppercase for daemon name
DAEMON_NAME="${DAEMON_TYPE}_${1^^}"
fi

"$DIR/_launch_daemon.sh" $@ "$DAEMON_NAME"

7 changes: 6 additions & 1 deletion dev/launch_scheduler.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,12 @@
DIR="$(cd $(dirname "$0"); pwd)"

DAEMON_TYPE="SCHEDULER"
DAEMON_NAME="${DAEMON_TYPE}_MASTER"
if [ $# -eq 0 ]; then
DAEMON_NAME="${DAEMON_TYPE}_MASTER"
else
# Make parameter as uppercase for daemon name
DAEMON_NAME="${DAEMON_TYPE}_${1^^}"
fi

"$DIR/_launch_daemon.sh" $@ "$DAEMON_NAME"

8 changes: 6 additions & 2 deletions dev/stop_arbiter.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,11 @@
DIR="$(cd $(dirname "$0"); pwd)"

DAEMON_TYPE="ARBITER"
DAEMON_NAME="${DAEMON_TYPE}_MASTER"
if [ $# -eq 0 ]; then
DAEMON_NAME="${DAEMON_TYPE}_MASTER"
else
# Make parameter as uppercase for daemon name
DAEMON_NAME="${DAEMON_TYPE}_${1^^}"
fi

"$DIR/_stop_daemon.sh" $@ "$DAEMON_NAME"

8 changes: 6 additions & 2 deletions dev/stop_broker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,11 @@
DIR="$(cd $(dirname "$0"); pwd)"

DAEMON_TYPE="BROKER"
DAEMON_NAME="${DAEMON_TYPE}_MASTER"
if [ $# -eq 0 ]; then
DAEMON_NAME="${DAEMON_TYPE}_MASTER"
else
# Make parameter as uppercase for daemon name
DAEMON_NAME="${DAEMON_TYPE}_${1^^}"
fi

"$DIR/_stop_daemon.sh" $@ "$DAEMON_NAME"

8 changes: 6 additions & 2 deletions dev/stop_poller.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,11 @@
DIR="$(cd $(dirname "$0"); pwd)"

DAEMON_TYPE="POLLER"
DAEMON_NAME="${DAEMON_TYPE}_MASTER"
if [ $# -eq 0 ]; then
DAEMON_NAME="${DAEMON_TYPE}_MASTER"
else
# Make parameter as uppercase for daemon name
DAEMON_NAME="${DAEMON_TYPE}_${1^^}"
fi

"$DIR/_stop_daemon.sh" $@ "$DAEMON_NAME"

8 changes: 6 additions & 2 deletions dev/stop_reactionner.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,11 @@
DIR="$(cd $(dirname "$0"); pwd)"

DAEMON_TYPE="REACTIONNER"
DAEMON_NAME="${DAEMON_TYPE}_MASTER"
if [ $# -eq 0 ]; then
DAEMON_NAME="${DAEMON_TYPE}_MASTER"
else
# Make parameter as uppercase for daemon name
DAEMON_NAME="${DAEMON_TYPE}_${1^^}"
fi

"$DIR/_stop_daemon.sh" $@ "$DAEMON_NAME"

8 changes: 6 additions & 2 deletions dev/stop_receiver.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,11 @@
DIR="$(cd $(dirname "$0"); pwd)"

DAEMON_TYPE="RECEIVER"
DAEMON_NAME="${DAEMON_TYPE}_MASTER"
if [ $# -eq 0 ]; then
DAEMON_NAME="${DAEMON_TYPE}_MASTER"
else
# Make parameter as uppercase for daemon name
DAEMON_NAME="${DAEMON_TYPE}_${1^^}"
fi

"$DIR/_stop_daemon.sh" $@ "$DAEMON_NAME"

8 changes: 6 additions & 2 deletions dev/stop_scheduler.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,11 @@
DIR="$(cd $(dirname "$0"); pwd)"

DAEMON_TYPE="SCHEDULER"
DAEMON_NAME="${DAEMON_TYPE}_MASTER"
if [ $# -eq 0 ]; then
DAEMON_NAME="${DAEMON_TYPE}_MASTER"
else
# Make parameter as uppercase for daemon name
DAEMON_NAME="${DAEMON_TYPE}_${1^^}"
fi

"$DIR/_stop_daemon.sh" $@ "$DAEMON_NAME"

10 changes: 5 additions & 5 deletions etc/alignak.ini
Original file line number Diff line number Diff line change
Expand Up @@ -73,36 +73,36 @@ SPECIFICCFG=
[arbiter-master]
### ARBITER PART ###
PROCESS=alignak-arbiter
DAEMON=%(BIN)s/alignak_arbiter.py
DAEMON=alignak-arbiter
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
DAEMON=alignak-scheduler
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
DAEMON=alignak-poller
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
DAEMON=alignak-reactionner
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
DAEMON=alignak-broker
CFG=%(ETC)s/daemons/brokerd.ini
DEBUGFILE=%(LOG)s/broker-debug.log

Expand Down

0 comments on commit a9cd430

Please sign in to comment.