Skip to content
This repository has been archived by the owner on Mar 8, 2023. It is now read-only.

Commit

Permalink
ffix variables in RedHat init scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
dwerder committed Apr 11, 2016
1 parent 2967e8c commit c5ce34f
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 20 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#### Bugfixes:

- (debfe5d) remove parameter `gr_pid_dir` and use `gr_storage_dir` instead.
- RedHat init scripts use correct `gr_base_dir` for graphite.

## 2016-04-01 - 6.0.1 (Bugfix release)

Expand Down
21 changes: 11 additions & 10 deletions templates/etc/init.d/RedHat/carbon-aggregator.erb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@

PYTHON_CMD='python -W ignore'
CARBON_DAEMON="aggregator"
GRAPHITE_DIR="/opt/graphite"
GRAPHITE_DIR="<%= scope.lookupvar('graphite::base_dir_REAL') %>"
PIDFILE_DIR="<%= scope.lookupvar('graphite::storage_dir_REAL') %>"
pidfile=""
OPERATION="$1"
if [ $# -gt 1 ]; then
Expand All @@ -37,14 +38,14 @@ start()
if [ "${INSTANCE}" = "${CARBON_DAEMON}" ]; then
INSTANCE="a";
fi;
pidfile=${GRAPHITE_DIR}/storage/carbon-${CARBON_DAEMON}-${INSTANCE}.pid
pidfile=${PIDFILE_DIR}/carbon-${CARBON_DAEMON}-${INSTANCE}.pid
prog=carbon-${CARBON_DAEMON}-${INSTANCE}
# check if instance is already running
rh_status_q && continue

${PYTHON_CMD} ${GRAPHITE_DIR}/bin/carbon-${CARBON_DAEMON}.py --instance=${INSTANCE} start;
retval=$?
pidfile=${GRAPHITE_DIR}/storage/carbon-${CARBON_DAEMON}-${INSTANCE}.pid
pidfile=${PIDFILE_DIR}/carbon-${CARBON_DAEMON}-${INSTANCE}.pid
echo -n $"Starting carbon-${CARBON_DAEMON}:${INSTANCE}..."
sleep 1
if rh_status_q; then
Expand All @@ -66,14 +67,14 @@ stop()
if [ "${INSTANCE}" = "${CARBON_DAEMON}" ]; then
INSTANCE="a";
fi;
pidfile=${GRAPHITE_DIR}/storage/carbon-${CARBON_DAEMON}-${INSTANCE}.pid
pidfile=${PIDFILE_DIR}/carbon-${CARBON_DAEMON}-${INSTANCE}.pid
prog=carbon-${CARBON_DAEMON}-${INSTANCE}
# check if instance is already stopped
rh_status_q || continue

${PYTHON_CMD} ${GRAPHITE_DIR}/bin/carbon-${CARBON_DAEMON}.py --instance=${INSTANCE} stop;
sleep 3
while [ -f ${GRAPHITE_DIR}/storage/carbon-${CARBON_DAEMON}-${INSTANCE}.pid ]; do
while [ -f ${PIDFILE_DIR}/carbon-${CARBON_DAEMON}-${INSTANCE}.pid ]; do
echo "waiting another 5 secs for carbon-${CARBON_DAEMON}-${INSTANCE} to stop"
sleep 5
#TODO: add timer to prevend endless waiting
Expand All @@ -93,12 +94,12 @@ restart() {
if [ "${INSTANCE}" = "${CARBON_DAEMON}" ]; then
INSTANCE="a";
fi;
pidfile=${GRAPHITE_DIR}/storage/carbon-${CARBON_DAEMON}-${INSTANCE}.pid
pidfile=${PIDFILE_DIR}/carbon-${CARBON_DAEMON}-${INSTANCE}.pid
prog=carbon-${CARBON_DAEMON}-${INSTANCE}

${PYTHON_CMD} ${GRAPHITE_DIR}/bin/carbon-${CARBON_DAEMON}.py --instance=${INSTANCE} stop;
sleep 3
while [ -f ${GRAPHITE_DIR}/storage/carbon-${CARBON_DAEMON}-${INSTANCE}.pid ]; do
while [ -f ${PIDFILE_DIR}/carbon-${CARBON_DAEMON}-${INSTANCE}.pid ]; do
echo "waiting another 5 secs for carbon-${CARBON_DAEMON}-${INSTANCE} to stop"
sleep 5
#TODO: add timer to prevend endless waiting
Expand All @@ -110,7 +111,7 @@ restart() {

${PYTHON_CMD} ${GRAPHITE_DIR}/bin/carbon-${CARBON_DAEMON}.py --instance=${INSTANCE} start;
retval=$?
pidfile=${GRAPHITE_DIR}/storage/carbon-${CARBON_DAEMON}-${INSTANCE}.pid
pidfile=${PIDFILE_DIR}/carbon-${CARBON_DAEMON}-${INSTANCE}.pid
echo -n $"Starting carbon-${CARBON_DAEMON}:${INSTANCE}..."
sleep 1
if rh_status_q; then
Expand Down Expand Up @@ -160,7 +161,7 @@ case "${OPERATION}" in
;;
condrestart|try-restart)
# TODO: bad behavior. only checking instance "a" at the moment
pidfile=${GRAPHITE_DIR}/storage/carbon-${CARBON_DAEMON}-a.pid
pidfile=${PIDFILE_DIR}/carbon-${CARBON_DAEMON}-a.pid
prog=carbon-${CARBON_DAEMON}-a
rh_status_q || exit 0
restart
Expand All @@ -170,7 +171,7 @@ case "${OPERATION}" in
if [ "${INSTANCE}" = "${CARBON_DAEMON}" ]; then
INSTANCE="a";
fi;
pidfile=${GRAPHITE_DIR}/storage/carbon-${CARBON_DAEMON}-${INSTANCE}.pid
pidfile=${PIDFILE_DIR}/carbon-${CARBON_DAEMON}-${INSTANCE}.pid
prog=carbon-${CARBON_DAEMON}-${INSTANCE}
rh_status
done
Expand Down
21 changes: 11 additions & 10 deletions templates/etc/init.d/RedHat/carbon-relay.erb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@

PYTHON_CMD='python -W ignore'
CARBON_DAEMON="relay"
GRAPHITE_DIR="/opt/graphite"
GRAPHITE_DIR="<%= scope.lookupvar('graphite::base_dir_REAL') %>"
PIDFILE_DIR="<%= scope.lookupvar('graphite::storage_dir_REAL') %>"
pidfile=""
OPERATION="$1"
if [ $# -gt 1 ]; then
Expand All @@ -40,14 +41,14 @@ start()
<% if @gr_carbon_relay_ulimit -%>
ulimit -n <%= @gr_carbon_relay_ulimit %>
<% end -%>
pidfile=${GRAPHITE_DIR}/storage/carbon-${CARBON_DAEMON}-${INSTANCE}.pid
pidfile=${PIDFILE_DIR}/carbon-${CARBON_DAEMON}-${INSTANCE}.pid
prog=carbon-${CARBON_DAEMON}-${INSTANCE}
# check if instance is already running
rh_status_q && continue

${PYTHON_CMD} ${GRAPHITE_DIR}/bin/carbon-${CARBON_DAEMON}.py --instance=${INSTANCE} start;
retval=$?
pidfile=${GRAPHITE_DIR}/storage/carbon-${CARBON_DAEMON}-${INSTANCE}.pid
pidfile=${PIDFILE_DIR}/carbon-${CARBON_DAEMON}-${INSTANCE}.pid
echo -n $"Starting carbon-${CARBON_DAEMON}:${INSTANCE}..."
sleep 1
if rh_status_q; then
Expand All @@ -69,14 +70,14 @@ stop()
if [ "${INSTANCE}" = "${CARBON_DAEMON}" ]; then
INSTANCE="a";
fi;
pidfile=${GRAPHITE_DIR}/storage/carbon-${CARBON_DAEMON}-${INSTANCE}.pid
pidfile=${PIDFILE_DIR}/carbon-${CARBON_DAEMON}-${INSTANCE}.pid
prog=carbon-${CARBON_DAEMON}-${INSTANCE}
# check if instance is already stopped
rh_status_q || continue

${PYTHON_CMD} ${GRAPHITE_DIR}/bin/carbon-${CARBON_DAEMON}.py --instance=${INSTANCE} stop;
sleep 3
while [ -f ${GRAPHITE_DIR}/storage/carbon-${CARBON_DAEMON}-${INSTANCE}.pid ]; do
while [ -f ${PIDFILE_DIR}/carbon-${CARBON_DAEMON}-${INSTANCE}.pid ]; do
echo "waiting another 5 secs for carbon-${CARBON_DAEMON}-${INSTANCE} to stop"
sleep 5
#TODO: add timer to prevend endless waiting
Expand All @@ -96,12 +97,12 @@ restart() {
if [ "${INSTANCE}" = "${CARBON_DAEMON}" ]; then
INSTANCE="a";
fi;
pidfile=${GRAPHITE_DIR}/storage/carbon-${CARBON_DAEMON}-${INSTANCE}.pid
pidfile=${PIDFILE_DIR}/carbon-${CARBON_DAEMON}-${INSTANCE}.pid
prog=carbon-${CARBON_DAEMON}-${INSTANCE}

${PYTHON_CMD} ${GRAPHITE_DIR}/bin/carbon-${CARBON_DAEMON}.py --instance=${INSTANCE} stop;
sleep 3
while [ -f ${GRAPHITE_DIR}/storage/carbon-${CARBON_DAEMON}-${INSTANCE}.pid ]; do
while [ -f ${PIDFILE_DIR}/carbon-${CARBON_DAEMON}-${INSTANCE}.pid ]; do
echo "waiting another 5 secs for carbon-${CARBON_DAEMON}-${INSTANCE} to stop"
sleep 5
#TODO: add timer to prevend endless waiting
Expand All @@ -113,7 +114,7 @@ restart() {

${PYTHON_CMD} ${GRAPHITE_DIR}/bin/carbon-${CARBON_DAEMON}.py --instance=${INSTANCE} start;
retval=$?
pidfile=${GRAPHITE_DIR}/storage/carbon-${CARBON_DAEMON}-${INSTANCE}.pid
pidfile=${PIDFILE_DIR}/carbon-${CARBON_DAEMON}-${INSTANCE}.pid
echo -n $"Starting carbon-${CARBON_DAEMON}:${INSTANCE}..."
sleep 1
if rh_status_q; then
Expand Down Expand Up @@ -163,7 +164,7 @@ case "${OPERATION}" in
;;
condrestart|try-restart)
# TODO: bad behavior. only checking instance "a" at the moment
pidfile=${GRAPHITE_DIR}/storage/carbon-${CARBON_DAEMON}-a.pid
pidfile=${PIDFILE_DIR}/carbon-${CARBON_DAEMON}-a.pid
prog=carbon-${CARBON_DAEMON}-a
rh_status_q || exit 0
restart
Expand All @@ -173,7 +174,7 @@ case "${OPERATION}" in
if [ "${INSTANCE}" = "${CARBON_DAEMON}" ]; then
INSTANCE="a";
fi;
pidfile=${GRAPHITE_DIR}/storage/carbon-${CARBON_DAEMON}-${INSTANCE}.pid
pidfile=${PIDFILE_DIR}/carbon-${CARBON_DAEMON}-${INSTANCE}.pid
prog=carbon-${CARBON_DAEMON}-${INSTANCE}
rh_status
done
Expand Down

0 comments on commit c5ce34f

Please sign in to comment.