Skip to content

Commit

Permalink
Clean-up shell-scripts.
Browse files Browse the repository at this point in the history
* Use /bin/sh when no bash-features are required.
* Update Copyright year to 2012 where appropriate.
* Quote all variables containing paths (as they may contain spaces).
* Replace back-tick command substitution by $(...) (which AFAIK is
  POSIX-conformant).
* Use same path for commandfile in all external_commands.
* Use `exec` instead of plenty of redirects.
  • Loading branch information
htgoebel committed Jul 16, 2012
1 parent f1b051d commit 73e6291
Show file tree
Hide file tree
Showing 31 changed files with 197 additions and 195 deletions.
24 changes: 12 additions & 12 deletions bin/launch_all.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

# Copyright (C) 2009-2011:
#!/bin/sh
#
# Copyright (C) 2009-2012:
# Gabes Jean, [email protected]
# Gerhard Lausser, [email protected]
# Gregory Starck, [email protected]
Expand All @@ -22,16 +22,16 @@
# along with Shinken. If not, see <http://www.gnu.org/licenses/>.


DIR=$(cd $(dirname "$0"); pwd)
echo "Going to dir" $DIR
DIR="$(cd $(dirname "$0"); pwd)"
echo "Going to dir $DIR"

cd $DIR/..
cd "$DIR"/..

export LANG=us_US.UTF-8

$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
24 changes: 12 additions & 12 deletions bin/launch_all_debug.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

# Copyright (C) 2009-2011:
#!/bin/sh
#
# Copyright (C) 2009-2012:
# Gabes Jean, [email protected]
# Gerhard Lausser, [email protected]
# Gregory Starck, [email protected]
Expand All @@ -22,16 +22,16 @@
# along with Shinken. If not, see <http://www.gnu.org/licenses/>.


DIR=$(cd $(dirname "$0"); pwd)
echo $DIR
DIR="$(cd $(dirname "$0"); pwd)"
echo "$DIR"

cd $DIR/..
cd "$DIR/.."

export LANG=us_US.UTF-8

$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
"$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
18 changes: 10 additions & 8 deletions bin/launch_arbiter.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

# Copyright (C) 2009-2011:
#!/bin/sh
#
# Copyright (C) 2009-2012:
# Gabes Jean, [email protected]
# Gerhard Lausser, [email protected]
# Gregory Starck, [email protected]
Expand All @@ -22,11 +22,13 @@
# along with Shinken. If not, see <http://www.gnu.org/licenses/>.


DIR=$(cd $(dirname "$0"); pwd)
BIN=$DIR"/../bin"
ETC=$DIR"/../etc"
DIR="$(cd $(dirname "$0"); pwd)"
BIN="$DIR"/../bin
ETC="$DIR"/../etc

# needed because arbiter doesn't have a default 'workdir' "properties" attribute:
# Need to change directory to .../var because arbiter doesn't have a
# default 'workdir' "properties" attribute:.
cd "$DIR/../var"

echo "Launching Arbiter (which reads configuration and dispatches it)"
$BIN/shinken-arbiter -d -c $ETC/nagios.cfg -c $ETC/shinken-specific.cfg
"$BIN"/shinken-arbiter -d -c "$ETC"/nagios.cfg -c "$ETC"/shinken-specific.cfg
24 changes: 14 additions & 10 deletions bin/launch_arbiter_debug.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

# Copyright (C) 2009-2011:
#!/bin/sh
#
# Copyright (C) 2009-2012:
# Gabes Jean, [email protected]
# Gerhard Lausser, [email protected]
# Gregory Starck, [email protected]
Expand All @@ -22,14 +22,18 @@
# along with Shinken. If not, see <http://www.gnu.org/licenses/>.


DIR=$(cd $(dirname "$0"); pwd)
BIN=$DIR"/../bin"
ETC=$DIR"/../etc"
DIR="$(cd $(dirname "$0"); pwd)"
BIN="$DIR"/../bin
ETC="$DIR"/../etc
DEBUG_PATH="/tmp/arbiter.debug"

# needed because arbiter doesn't have a default 'workdir' "properties" attribute:
cd "$DIR/../var"
echo "Launching Arbiter (which reads configuration and dispatches it) in debug mode to the file $DEBUG_PATH"
$BIN/shinken-arbiter -d -c $ETC/nagios.cfg -c $ETC/shinken-specific.cfg -c $ETC/sample.cfg --debug $DEBUG_PATH -p /tmp/arbiter.profile
# Need to change directory to .../var because arbiter doesn't have a
# default 'workdir' "properties" attribute:.
cd "$DIR"/../var

echo "Launching Arbiter (which reads configuration and dispatches it) " \
"in debug mode to the file $DEBUG_PATH"

"$BIN"/shinken-arbiter -d \
-c "$ETC"/nagios.cfg -c "$ETC"/shinken-specific.cfg -c "$ETC"/sample.cfg \
--debug "$DEBUG_PATH" -p /tmp/arbiter.profile
14 changes: 7 additions & 7 deletions bin/launch_broker.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

# Copyright (C) 2009-2011:
#!/bin/sh
#
# Copyright (C) 2009-2012:
# Gabes Jean, [email protected]
# Gerhard Lausser, [email protected]
# Gregory Starck, [email protected]
Expand All @@ -22,9 +22,9 @@
# along with Shinken. If not, see <http://www.gnu.org/licenses/>.


DIR=$(cd $(dirname "$0"); pwd)
BIN=$DIR"/../bin"
ETC=$DIR"/../etc"
DIR="$(cd $(dirname "$0"); pwd)"
BIN="$DIR"/../bin
ETC="$DIR"/../etc

echo "Launching Broker (which exports all data)"
$BIN/shinken-broker -d -c $ETC/brokerd.ini
"$BIN"/shinken-broker -d -c "$ETC"/brokerd.ini
14 changes: 7 additions & 7 deletions bin/launch_broker_debug.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

# Copyright (C) 2009-2011:
#!/bin/sh
#
# Copyright (C) 2009-2012:
# Gabes Jean, [email protected]
# Gerhard Lausser, [email protected]
# Gregory Starck, [email protected]
Expand All @@ -22,10 +22,10 @@
# along with Shinken. If not, see <http://www.gnu.org/licenses/>.


DIR=$(cd $(dirname "$0"); pwd)
BIN=$DIR"/../bin"
ETC=$DIR"/../etc"
DIR="$(cd $(dirname "$0"); pwd)"
BIN="$DIR"/../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/shinken-broker -d -c $ETC/brokerd.ini --debug $DEBUG_PATH
"$BIN"/shinken-broker -d -c "$ETC"/brokerd.ini --debug "$DEBUG_PATH"
14 changes: 7 additions & 7 deletions bin/launch_poller.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

# Copyright (C) 2009-2011:
#!/bin/sh
#
# Copyright (C) 2009-2012:
# Gabes Jean, [email protected]
# Gerhard Lausser, [email protected]
# Gregory Starck, [email protected]
Expand All @@ -22,9 +22,9 @@
# along with Shinken. If not, see <http://www.gnu.org/licenses/>.


DIR=$(cd $(dirname "$0"); pwd)
BIN=$DIR"/../bin"
ETC=$DIR"/../etc"
DIR="$(cd $(dirname "$0"); pwd)"
BIN="$DIR"/../bin
ETC="$DIR"/../etc

echo "Launching Poller (which launches checks)"
$BIN/shinken-poller -d -c $ETC/pollerd.ini
"$BIN"/shinken-poller -d -c "$ETC"/pollerd.ini
15 changes: 7 additions & 8 deletions bin/launch_poller_debug.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#!/bin/bash


# Copyright (C) 2009-2011:
#!/bin/sh
#
# Copyright (C) 2009-2012:
# Gabes Jean, [email protected]
# Gerhard Lausser, [email protected]
# Gregory Starck, [email protected]
Expand All @@ -23,10 +22,10 @@
# along with Shinken. If not, see <http://www.gnu.org/licenses/>.


DIR=$(cd $(dirname "$0"); pwd)
BIN=$DIR"/../bin"
ETC=$DIR"/../etc"
DIR="$(cd $(dirname "$0"); pwd)"
BIN="$DIR"/../bin
ETC="$DIR"/../etc
DEBUG_PATH="/tmp/poller.debug"

echo "Launching Poller (which launches checks) in debug mode to the file $DEBUG_PATH"
$BIN/shinken-poller -d -c $ETC/pollerd.ini --debug $DEBUG_PATH
"$BIN"/shinken-poller -d -c "$ETC"/pollerd.ini --debug "$DEBUG_PATH"
15 changes: 7 additions & 8 deletions bin/launch_reactionner.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#!/bin/bash


# Copyright (C) 2009-2011:
#!/bin/sh
#
# Copyright (C) 2009-2012:
# Gabes Jean, [email protected]
# Gerhard Lausser, [email protected]
# Gregory Starck, [email protected]
Expand All @@ -23,9 +22,9 @@
# along with Shinken. If not, see <http://www.gnu.org/licenses/>.


DIR=$(cd $(dirname "$0"); pwd)
BIN=$DIR"/../bin"
ETC=$DIR"/../etc"
DIR="$(cd $(dirname "$0"); pwd)"
BIN="$DIR"/../bin
ETC="$DIR"/../etc

echo "Launching Reactionner (which sends notifications)"
$BIN/shinken-reactionner -d -c $ETC/reactionnerd.ini
"$BIN"/shinken-reactionner -d -c "$ETC"/reactionnerd.ini
14 changes: 7 additions & 7 deletions bin/launch_reactionner_debug.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

# Copyright (C) 2009-2011:
#!/bin/sh
#
# Copyright (C) 2009-2012:
# Gabes Jean, [email protected]
# Gerhard Lausser, [email protected]
# Gregory Starck, [email protected]
Expand All @@ -22,10 +22,10 @@
# along with Shinken. If not, see <http://www.gnu.org/licenses/>.


DIR=$(cd $(dirname "$0"); pwd)
BIN=$DIR"/../bin"
ETC=$DIR"/../etc"
DIR="$(cd $(dirname "$0"); pwd)"
BIN="$DIR"/../bin
ETC="$DIR"/../etc
DEBUG_PATH="/tmp/reactionner.debug"

echo "Launching Reactionner (which sends notifications) in debug mode to the file $DEBUG_PATH"
$BIN/shinken-reactionner -d -c $ETC/reactionnerd.ini --debug $DEBUG_PATH
"$BIN"/shinken-reactionner -d -c "$ETC"/reactionnerd.ini --debug "$DEBUG_PATH"
14 changes: 7 additions & 7 deletions bin/launch_receiver.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

# Copyright (C) 2009-2011:
#!/bin/sh
#
# Copyright (C) 2009-2012:
# Gabes Jean, [email protected]
# Gerhard Lausser, [email protected]
# Gregory Starck, [email protected]
Expand All @@ -22,9 +22,9 @@
# along with Shinken. If not, see <http://www.gnu.org/licenses/>.


DIR=$(cd $(dirname "$0"); pwd)
BIN=$DIR"/../bin"
ETC=$DIR"/../etc"
DIR="$(cd $(dirname "$0"); pwd)"
BIN="$DIR"/../bin
ETC="$DIR"/../etc

echo "Launching Receiver (which manages passive data)"
$BIN/shinken-receiver -d -c $ETC/receiverd.ini
"$BIN"/shinken-receiver -d -c "$ETC"/receiverd.ini
14 changes: 7 additions & 7 deletions bin/launch_receiver_debug.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

# Copyright (C) 2009-2011:
#!/bin/sh
#
# Copyright (C) 2009-2012:
# Gabes Jean, [email protected]
# Gerhard Lausser, [email protected]
# Gregory Starck, [email protected]
Expand All @@ -22,10 +22,10 @@
# along with Shinken. If not, see <http://www.gnu.org/licenses/>.


DIR=$(cd $(dirname "$0"); pwd)
BIN=$DIR"/../bin"
ETC=$DIR"/../etc"
DIR="$(cd $(dirname "$0"); pwd)"
BIN="$DIR"/../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/shinken-receiver -d -c $ETC/receiverd.ini --debug $DEBUG_PATH
"$BIN"/shinken-receiver -d -c "$ETC"/receiverd.ini --debug "$DEBUG_PATH"
14 changes: 7 additions & 7 deletions bin/launch_scheduler.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

# Copyright (C) 2009-2011:
#!/bin/sh
#
# Copyright (C) 2009-2012:
# Gabes Jean, [email protected]
# Gerhard Lausser, [email protected]
# Gregory Starck, [email protected]
Expand All @@ -22,9 +22,9 @@
# along with Shinken. If not, see <http://www.gnu.org/licenses/>.


DIR=$(cd $(dirname "$0"); pwd)
BIN=$DIR"/../bin"
ETC=$DIR"/../etc"
DIR="$(cd $(dirname "$0"); pwd)"
BIN="$DIR"/../bin
ETC="$DIR"/../etc

echo "Launching Scheduler (that is only in charge of scheduling)"
$BIN/shinken-scheduler -d -c $ETC/schedulerd.ini
"$BIN"/shinken-scheduler -d -c "$ETC"/schedulerd.ini
14 changes: 7 additions & 7 deletions bin/launch_scheduler_debug.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

# Copyright (C) 2009-2011:
#!/bin/sh
#
# Copyright (C) 2009-2012:
# Gabes Jean, [email protected]
# Gerhard Lausser, [email protected]
# Gregory Starck, [email protected]
Expand All @@ -22,10 +22,10 @@
# along with Shinken. If not, see <http://www.gnu.org/licenses/>.


DIR=$(cd $(dirname "$0"); pwd)
BIN=$DIR"/../bin"
ETC=$DIR"/../etc"
DIR="$(cd $(dirname "$0"); pwd)"
BIN="$DIR"/../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/shinken-scheduler -d -c $ETC/schedulerd.ini --debug $DEBUG_PATH
"$BIN"/shinken-scheduler -d -c "$ETC"/schedulerd.ini --debug "$DEBUG_PATH"
Loading

0 comments on commit 73e6291

Please sign in to comment.