diff --git a/CHANGELOG.md b/CHANGELOG.md index a3005e47..cd39821c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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) diff --git a/templates/etc/init.d/RedHat/carbon-aggregator.erb b/templates/etc/init.d/RedHat/carbon-aggregator.erb index e484c664..aeb8f49f 100644 --- a/templates/etc/init.d/RedHat/carbon-aggregator.erb +++ b/templates/etc/init.d/RedHat/carbon-aggregator.erb @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 diff --git a/templates/etc/init.d/RedHat/carbon-relay.erb b/templates/etc/init.d/RedHat/carbon-relay.erb index 55dd6f18..7a978efb 100644 --- a/templates/etc/init.d/RedHat/carbon-relay.erb +++ b/templates/etc/init.d/RedHat/carbon-relay.erb @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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