diff --git a/templates/init.d/dynaTraceAnalysis.erb b/templates/init.d/dynaTraceAnalysis.erb index 50e56a6..10666f7 100644 --- a/templates/init.d/dynaTraceAnalysis.erb +++ b/templates/init.d/dynaTraceAnalysis.erb @@ -51,7 +51,7 @@ fi case "$1" in 'start') - if [ -z "${PROCESSPID}" ]; then + if [ -z "${PROCESSPID}" ]; then if [ -z "${DT_RUNASUSER}" ]; then echo "${DT_HOME}"/${DT_BINARY} -bg ${DT_OPTARGS} "${DT_HOME}"/${DT_BINARY} -bg ${DT_OPTARGS} @@ -61,45 +61,49 @@ case "$1" in su -c "${DT_HOME}/${DT_BINARY} -bg ${DT_OPTARGS}" "${DT_RUNASUSER}" echo $! >${DT_PIDFILE} fi - else + else echo "Dynatrace ${DT_PRODUCT} daemon is already running!" - exit 1 - fi - ;; + fi + ;; 'stop') - if [ -n "${PROCESSPID}" ]; then - echo "Terminating Dynatrace ${DT_PRODUCT} process ${PROCESSPID}" - kill -15 ${PROCESSPID} - COUNT=0; - while [ `ps -A -o pid | grep -c ${PROCESSPID}` -gt 0 ] && [ "${COUNT}" -lt "${DT_SHUTDOWN_WAIT}" ] # `ps --pid ${PROCESSPID} | grep -c ${PROCESSPID}` -ne 0] - do - echo "Waiting for Dynatrace ${DT_PRODUCT} (${PROCESSPID}) to finish shutdown"; - sleep 1 - COUNT=`expr ${COUNT} + 1` - done + if [ -n "${PROCESSPID}" ]; then + echo "Terminating Dynatrace ${DT_PRODUCT} process ${PROCESSPID}" + kill -15 ${PROCESSPID} + + COUNT=0; + while [ `ps -A -o pid | grep -c ${PROCESSPID}` -gt 0 ] && [ "${COUNT}" -lt "${DT_SHUTDOWN_WAIT}" ] # `ps --pid ${PROCESSPID} | grep -c ${PROCESSPID}` -ne 0] + do + echo "Waiting for Dynatrace ${DT_PRODUCT} (${PROCESSPID}) to finish shutdown"; + sleep 1 + COUNT=`expr ${COUNT} + 1` + done + + if [ "${COUNT}" -gt "${DT_SHUTDOWN_WAIT}" ]; then + echo "Killing Dynatrace ${DT_PRODUCT} (${PROCESSPID}) because the shutdown lasted longer than ${DT_SHUTDOWN_WAIT} seconds" + kill -9 ${PROCESSPID} + fi - if [ "${COUNT}" -gt "${DT_SHUTDOWN_WAIT}" ]; then - echo "Killing Dynatrace ${DT_PRODUCT} (${PROCESSPID}) because the shutdown lasted longer than ${DT_SHUTDOWN_WAIT} seconds" - kill -9 ${PROCESSPID} - fi if [ -f "${DT_PIDFILE}" ]; then rm -f ${DT_PIDFILE} fi - fi - ;; + fi + ;; 'version') - "${DT_HOME}"/${DT_BINARY} -v - ;; + "${DT_HOME}"/${DT_BINARY} -v + ;; 'status') - if [ -n "${PROCESSPID}" ]; then - echo "Dynatrace ${DT_PRODUCT} daemon is running:" - ps -ef | grep ${DT_BINARY} | grep ${PROCESSPID} - # | grep -v org.eclipse.equinox - else - echo "Dynatrace ${DT_PRODUCT} daemon not running." - fi - ;; + if [ -n "${PROCESSPID}" ]; then + echo "Dynatrace ${DT_PRODUCT} daemon is running:" + ps -ef | grep ${DT_BINARY} | grep ${PROCESSPID} + # | grep -v org.eclipse.equinox + else + echo "Dynatrace ${DT_PRODUCT} daemon not running." + exit 1 + fi + ;; *) - echo "usage: $0 {start|stop|status|version}" - ;; + echo "usage: $0 {start|stop|status|version}" + ;; esac + +exit 0 diff --git a/templates/init.d/dynaTraceBackendServer.erb b/templates/init.d/dynaTraceBackendServer.erb index 9c80051..fa23d78 100755 --- a/templates/init.d/dynaTraceBackendServer.erb +++ b/templates/init.d/dynaTraceBackendServer.erb @@ -54,7 +54,7 @@ fi case "$1" in 'start') - if [ -z "${PROCESSPID}" ]; then + if [ -z "${PROCESSPID}" ]; then if [ -z "${DT_RUNASUSER}" ]; then echo "${DT_HOME}"/${DT_BINARY} -bg ${DT_OPTARGS} "${DT_HOME}"/${DT_BINARY} -bg ${DT_OPTARGS} @@ -64,44 +64,48 @@ case "$1" in su -c "${DT_HOME}/${DT_BINARY} -bg ${DT_OPTARGS}" "${DT_RUNASUSER}" echo $! >${DT_PIDFILE} fi - else + else echo "Dynatrace ${DT_PRODUCT} daemon is already running!" - exit 1 - fi - ;; + fi + ;; 'stop') - if [ -n "${PROCESSPID}" ]; then + if [ -n "${PROCESSPID}" ]; then echo "Terminating Dynatrace $DT_PRODUCT process ${PROCESSPID}" kill -15 ${PROCESSPID} + COUNT=0; while [ `ps -A -o pid | grep -c ${PROCESSPID}` -gt 0 ] && [ "${COUNT}" -lt "${DT_SHUTDOWN_WAIT}" ] # `ps --pid ${PROCESSPID} | grep -c ${PROCESSPID}` -ne 0] - do - echo "Waiting for Dynatrace $DT_PRODUCT (${PROCESSPID}) to finish shutdown"; - sleep 1 - COUNT=`expr ${COUNT} + 1` - done + do + echo "Waiting for Dynatrace $DT_PRODUCT (${PROCESSPID}) to finish shutdown"; + sleep 1 + COUNT=`expr ${COUNT} + 1` + done + + if [ "${COUNT}" -gt "${DT_SHUTDOWN_WAIT}" ]; then + echo "Killing Dynatrace $DT_PRODUCT (${PROCESSPID}) because the shutdown lasted longer than ${DT_SHUTDOWN_WAIT} seconds" + kill -9 ${PROCESSPID} + fi - if [ "${COUNT}" -gt "${DT_SHUTDOWN_WAIT}" ]; then - echo "Killing Dynatrace $DT_PRODUCT (${PROCESSPID}) because the shutdown lasted longer than ${DT_SHUTDOWN_WAIT} seconds" - kill -9 ${PROCESSPID} - fi if [ -f "${DT_PIDFILE}" ]; then rm -f ${DT_PIDFILE} fi - fi - ;; + fi + ;; 'version') - "${DT_HOME}"/${DT_BINARY} -v - ;; + "${DT_HOME}"/${DT_BINARY} -v + ;; 'status') - if [ -n "${PROCESSPID}" ]; then + if [ -n "${PROCESSPID}" ]; then echo "Dynatrace ${DT_PRODUCT} daemon is running:" ps -ef | grep ${DT_BINARY} | grep ${PROCESSPID} - else + else echo "Dynatrace ${DT_PRODUCT} daemon not running." - fi - ;; + exit 1 + fi + ;; *) - echo "usage: $0 {start|stop|status|version}" - ;; + echo "usage: $0 {start|stop|status|version}" + ;; esac + +exit 0 diff --git a/templates/init.d/dynaTraceCollector.erb b/templates/init.d/dynaTraceCollector.erb index cca9bd1..a681fb3 100755 --- a/templates/init.d/dynaTraceCollector.erb +++ b/templates/init.d/dynaTraceCollector.erb @@ -68,7 +68,7 @@ fi case "$1" in 'start') - if [ -z "${PROCESSPID}" ]; then + if [ -z "${PROCESSPID}" ]; then if [ -z "${DT_INSTANCE}" ]; then if [ -z "${DT_RUNASUSER}" ]; then echo "${DT_HOME}"/${DT_BINARY} -bg ${DT_OPTARGS} @@ -98,15 +98,15 @@ case "$1" in echo $! >${DT_PIDFILE} fi fi - else + else echo "Dynatrace ${DT_PRODUCT} daemon is already running!" - exit 1 - fi - ;; + fi + ;; 'stop') - if [ -n "${PROCESSPID}" ]; then + if [ -n "${PROCESSPID}" ]; then echo "Terminating Dynatrace $DT_PRODUCT process ${PROCESSPID}" kill -15 ${PROCESSPID} + COUNT=0 while [ `ps -A -o pid | grep -c ${PROCESSPID}` -gt 0 ] && [ "${COUNT}" -lt "${DT_SHUTDOWN_WAIT}" ] # `ps --pid ${PROCESSPID} | grep -c ${PROCESSPID}` -ne 0] do @@ -114,28 +114,33 @@ case "$1" in sleep 1 COUNT=`expr ${COUNT} + 1` done + if [ "${COUNT}" -gt "${DT_SHUTDOWN_WAIT}" ]; then echo "Killing Dynatrace ${DT_PRODUCT} (${PROCESSPID}) because the shutdown lasted longer than ${DT_SHUTDOWN_WAIT} seconds" kill -9 ${PROCESSPID} fi + if [ -f "${DT_PIDFILE}" ]; then rm -f ${DT_PIDFILE} fi - fi - ;; + fi + ;; 'version') - "${DT_HOME}"/${DT_BINARY} -v - ;; + "${DT_HOME}"/${DT_BINARY} -v + ;; 'status') - if [ -n "${PROCESSPID}" ]; then + if [ -n "${PROCESSPID}" ]; then echo "Dynatrace ${DT_PRODUCT} daemon is running:" ps -ef | grep ${DT_BINARY} | grep ${PROCESSPID} # | grep -v org.eclipse.equinox - else + else echo "Dynatrace ${DT_PRODUCT} daemon not running." - fi - ;; + exit 1 + fi + ;; *) - echo "usage: $0 {start|stop|status|version}" - ;; -esac \ No newline at end of file + echo "usage: $0 {start|stop|status|version}" + ;; +esac + +exit 0 diff --git a/templates/init.d/dynaTraceFrontendServer.erb b/templates/init.d/dynaTraceFrontendServer.erb index a6acc42..d94acef 100755 --- a/templates/init.d/dynaTraceFrontendServer.erb +++ b/templates/init.d/dynaTraceFrontendServer.erb @@ -55,7 +55,7 @@ fi case "$1" in 'start') - if [ -z "${PROCESSPID}" ]; then + if [ -z "${PROCESSPID}" ]; then if [ -z "${DT_RUNASUSER}" ]; then echo "${DT_HOME}"/${DT_BINARY} -bg ${DT_OPTARGS} "${DT_HOME}"/${DT_BINARY} -bg ${DT_OPTARGS} @@ -65,44 +65,48 @@ case "$1" in su -c "${DT_HOME}/${DT_BINARY} -bg ${DT_OPTARGS}" "${DT_RUNASUSER}" echo $! >${DT_PIDFILE} fi - else + else echo "Dynatrace ${DT_PRODUCT} daemon is already running!" - exit 1 - fi - ;; + fi + ;; 'stop') - if [ -n "${PROCESSPID}" ]; then - echo "Terminating Dynatrace $DT_PRODUCT process ${PROCESSPID}" - kill -15 ${PROCESSPID} + if [ -n "${PROCESSPID}" ]; then + echo "Terminating Dynatrace $DT_PRODUCT process ${PROCESSPID}" + kill -15 ${PROCESSPID} + COUNT=0; - while [ `ps -A -o pid | grep -c ${PROCESSPID}` -gt 0 ] && [ "${COUNT}" -lt "${DT_SHUTDOWN_WAIT}" ] # `ps --pid ${PROCESSPID} | grep -c ${PROCESSPID}` -ne 0] - do - echo "Waiting for Dynatrace ${DT_PRODUCT} (${PROCESSPID}) to finish shutdown"; - sleep 1 - COUNT=`expr ${COUNT} + 1` - done + while [ `ps -A -o pid | grep -c ${PROCESSPID}` -gt 0 ] && [ "${COUNT}" -lt "${DT_SHUTDOWN_WAIT}" ] # `ps --pid ${PROCESSPID} | grep -c ${PROCESSPID}` -ne 0] + do + echo "Waiting for Dynatrace ${DT_PRODUCT} (${PROCESSPID}) to finish shutdown"; + sleep 1 + COUNT=`expr ${COUNT} + 1` + done + + if [ "${COUNT}" -gt "${DT_SHUTDOWN_WAIT}" ]; then + echo "Killing Dynatrace ${DT_PRODUCT} (${PROCESSPID}) because the shutdown lasted longer than ${DT_SHUTDOWN_WAIT} seconds" + kill -9 ${PROCESSPID} + fi - if [ "${COUNT}" -gt "${DT_SHUTDOWN_WAIT}" ]; then - echo "Killing Dynatrace ${DT_PRODUCT} (${PROCESSPID}) because the shutdown lasted longer than ${DT_SHUTDOWN_WAIT} seconds" - kill -9 ${PROCESSPID} - fi if [ -f "${DT_PIDFILE}" ]; then rm -f ${DT_PIDFILE} fi - fi - ;; + fi + ;; 'version') - "${DT_HOME}"/${DT_BINARY} -v - ;; + "${DT_HOME}"/${DT_BINARY} -v + ;; 'status') - if [ -n "${PROCESSPID}" ]; then + if [ -n "${PROCESSPID}" ]; then echo "Dynatrace ${DT_PRODUCT} daemon is running:" ps -ef | grep ${DT_BINARY} | grep ${PROCESSPID} - else + else echo "Dynatrace ${DT_PRODUCT} daemon not running." - fi - ;; + exit 1 + fi + ;; *) - echo "usage: $0 {start|stop|status|version}" - ;; + echo "usage: $0 {start|stop|status|version}" + ;; esac + +exit 0 diff --git a/templates/init.d/dynaTraceServer.erb b/templates/init.d/dynaTraceServer.erb index 150d0b9..99d2ea6 100755 --- a/templates/init.d/dynaTraceServer.erb +++ b/templates/init.d/dynaTraceServer.erb @@ -88,14 +88,13 @@ frontendstart() { su -c "${DT_HOME}/${DT_FE_BINARY} -bg ${DT_FE_OPTARGS}" "${DT_RUNASUSER}" echo $! >${DT_FE_PIDFILE} fi - else + else echo "Dynatrace ${DT_FE_PRODUCT} daemon is already running!" - exit 1 - fi + fi } backendstart() { - if [ -z "${PROCESSPID}" ]; then + if [ -z "${PROCESSPID}" ]; then if [ -z "${DT_RUNASUSER}" ]; then echo "${DT_HOME}"/${DT_BINARY} -bg ${DT_OPTARGS} "${DT_HOME}"/${DT_BINARY} -bg ${DT_OPTARGS} @@ -105,98 +104,106 @@ backendstart() { su -c "${DT_HOME}/${DT_BINARY} -bg ${DT_OPTARGS}" "${DT_RUNASUSER}" echo $! >${DT_PIDFILE} fi - else + else echo "Dynatrace ${DT_PRODUCT} daemon is already running!" - exit 1 - fi + fi } frontendstop() { if [ -n "${FE_PROCESSPID}" ]; then - echo "Terminating Dynatrace ${DT_FE_PRODUCT} process ${FE_PROCESSPID}" - kill -15 ${FE_PROCESSPID} + echo "Terminating Dynatrace ${DT_FE_PRODUCT} process ${FE_PROCESSPID}" + kill -15 ${FE_PROCESSPID} + COUNT=0; - while [ `ps -A -o pid | grep -c ${FE_PROCESSPID}` -gt 0 ] && [ "${COUNT}" -lt "${DT_SHUTDOWN_WAIT}" ] # `ps --pid ${FE_PROCESSPID} | grep -c ${FE_PROCESSPID}` -ne 0] - do - echo "Waiting for Dynatrace ${DT_FE_PRODUCT} (${FE_PROCESSPID}) to finish shutdown"; - sleep 1 - COUNT=`expr ${COUNT} + 1` - done - - if [ "${COUNT}" -gt "${DT_SHUTDOWN_WAIT}" ]; then - echo "Killing Dynatrace ${DT_FE_PRODUCT} (${FE_PROCESSPID}) because the shutdown lasted longer than ${DT_SHUTDOWN_WAIT} seconds" - kill -9 ${FE_PROCESSPID} - fi + while [ `ps -A -o pid | grep -c ${FE_PROCESSPID}` -gt 0 ] && [ "${COUNT}" -lt "${DT_SHUTDOWN_WAIT}" ] # `ps --pid ${FE_PROCESSPID} | grep -c ${FE_PROCESSPID}` -ne 0] + do + echo "Waiting for Dynatrace ${DT_FE_PRODUCT} (${FE_PROCESSPID}) to finish shutdown"; + sleep 1 + COUNT=`expr ${COUNT} + 1` + done + + if [ "${COUNT}" -gt "${DT_SHUTDOWN_WAIT}" ]; then + echo "Killing Dynatrace ${DT_FE_PRODUCT} (${FE_PROCESSPID}) because the shutdown lasted longer than ${DT_SHUTDOWN_WAIT} seconds" + kill -9 ${FE_PROCESSPID} + fi + if [ -f "${DT_FE_PIDFILE}" ]; then rm -f ${DT_FE_PIDFILE} fi - fi + fi } backendstop() { - if [ -n "${PROCESSPID}" ]; then - echo "Terminating Dynatrace ${DT_PRODUCT} process ${PROCESSPID}" - kill -15 ${PROCESSPID} + if [ -n "${PROCESSPID}" ]; then + echo "Terminating Dynatrace ${DT_PRODUCT} process ${PROCESSPID}" + kill -15 ${PROCESSPID} + COUNT=0; - while [ `ps -A -o pid | grep -c ${PROCESSPID}` -gt 0 ] && [ "${COUNT}" -lt "${DT_SHUTDOWN_WAIT}" ] # `ps --pid ${PROCESSPID} | grep -c ${PROCESSPID}` -ne 0] - do - echo "Waiting for Dynatrace $DT_PRODUCT (${PROCESSPID}) to finish shutdown"; - sleep 1 - COUNT=`expr ${COUNT} + 1` - done - - if [ "${COUNT}" -gt "${DT_SHUTDOWN_WAIT}" ]; then - echo "Killing Dynatrace $DT_PRODUCT (${PROCESSPID}) because the shutdown lasted longer than ${DT_SHUTDOWN_WAIT} seconds" - kill -9 ${PROCESSPID} - fi + while [ `ps -A -o pid | grep -c ${PROCESSPID}` -gt 0 ] && [ "${COUNT}" -lt "${DT_SHUTDOWN_WAIT}" ] # `ps --pid ${PROCESSPID} | grep -c ${PROCESSPID}` -ne 0] + do + echo "Waiting for Dynatrace $DT_PRODUCT (${PROCESSPID}) to finish shutdown"; + sleep 1 + COUNT=`expr ${COUNT} + 1` + done + + if [ "${COUNT}" -gt "${DT_SHUTDOWN_WAIT}" ]; then + echo "Killing Dynatrace $DT_PRODUCT (${PROCESSPID}) because the shutdown lasted longer than ${DT_SHUTDOWN_WAIT} seconds" + kill -9 ${PROCESSPID} + fi + if [ -f "${DT_PIDFILE}" ]; then rm -f ${DT_PIDFILE} fi - fi + fi } case "$1" in 'start') backendstart frontendstart - ;; + ;; 'start-frontend') frontendstart - ;; + ;; 'start-backend') - backendstart - ;; + backendstart + ;; 'stop') frontendstop backendstop - ;; + ;; 'stop-frontend') frontendstop - ;; + ;; 'stop-backend') - backendstop - ;; + backendstop + ;; 'version') - "${DT_HOME}/${DT_BINARY}" -v + "${DT_HOME}/${DT_BINARY}" -v "${DT_HOME}/${DT_FE_BINARY}" -v - ;; + ;; 'status') - if [ -n "${PROCESSPID}" ]; then - echo "Dynatrace ${DT_PRODUCT} daemon is running:" - ps -ef | grep ${DT_BINARY} | grep ${PROCESSPID} - # | grep -v org.eclipse.equinox - else - echo "Dynatrace ${DT_PRODUCT} daemon not running." - fi + if [ -n "${PROCESSPID}" ]; then + echo "Dynatrace ${DT_PRODUCT} daemon is running:" + ps -ef | grep ${DT_BINARY} | grep ${PROCESSPID} + # | grep -v org.eclipse.equinox + else + echo "Dynatrace ${DT_PRODUCT} daemon not running." + exit 1 + fi + if [ -n "${FE_PROCESSPID}" ]; then - echo "Dynatrace ${DT_FE_PRODUCT} daemon is running:" - ps -ef | grep ${DT_FE_BINARY} | grep ${FE_PROCESSPID} - # | grep -v org.eclipse.equinox - else - echo "Dynatrace ${DT_FE_PRODUCT} daemon not running." - fi - ;; + echo "Dynatrace ${DT_FE_PRODUCT} daemon is running:" + ps -ef | grep ${DT_FE_BINARY} | grep ${FE_PROCESSPID} + # | grep -v org.eclipse.equinox + else + echo "Dynatrace ${DT_FE_PRODUCT} daemon not running." + exit 1 + fi + ;; *) - echo "usage: $0 {start|start-frontend|start-backend|stop|stop-frontend|stop-backend|status|version|}" - ;; + echo "usage: $0 {start|start-frontend|start-backend|stop|stop-frontend|stop-backend|status|version|}" + ;; esac + +exit 0 diff --git a/templates/init.d/dynaTraceWebServerAgent.erb b/templates/init.d/dynaTraceWebServerAgent.erb index 9fc1717..c3e23d0 100755 --- a/templates/init.d/dynaTraceWebServerAgent.erb +++ b/templates/init.d/dynaTraceWebServerAgent.erb @@ -76,37 +76,42 @@ case "$1" in fi echo $! >${DT_PIDFILE} fi - ;; + ;; 'stop') - if [ -n "${PROCESSPID}" ]; then + if [ -n "${PROCESSPID}" ]; then echo "Terminating Dynatrace $DT_PRODUCT process ${PROCESSPID}" kill -15 ${PROCESSPID} + COUNT=0; - while [ `ps -A -o pid | grep -c ${PROCESSPID}` -gt 0 ] && [ "${COUNT}" -lt "${DT_SHUTDOWN_WAIT}" ] # `ps --pid ${PROCESSPID} | grep -c ${PROCESSPID}` -ne 0] - do - echo "Waiting for Dynatrace $DT_PRODUCT (${PROCESSPID}) to finish shutdown"; - sleep 1 - COUNT=`expr ${COUNT} + 1` - done - - if [ "${COUNT}" -gt "${DT_SHUTDOWN_WAIT}" ]; then - echo "Killing Dynatrace ${DT_PRODUCT} (${PROCESSPID}) because the shutdown lasted longer than ${DT_SHUTDOWN_WAIT} seconds" - kill -9 ${PROCESSPID} - fi + while [ `ps -A -o pid | grep -c ${PROCESSPID}` -gt 0 ] && [ "${COUNT}" -lt "${DT_SHUTDOWN_WAIT}" ] # `ps --pid ${PROCESSPID} | grep -c ${PROCESSPID}` -ne 0] + do + echo "Waiting for Dynatrace $DT_PRODUCT (${PROCESSPID}) to finish shutdown"; + sleep 1 + COUNT=`expr ${COUNT} + 1` + done + + if [ "${COUNT}" -gt "${DT_SHUTDOWN_WAIT}" ]; then + echo "Killing Dynatrace ${DT_PRODUCT} (${PROCESSPID}) because the shutdown lasted longer than ${DT_SHUTDOWN_WAIT} seconds" + kill -9 ${PROCESSPID} + fi + if [ -f "${DT_PIDFILE}" ]; then rm -f ${DT_PIDFILE} fi - fi - ;; + fi + ;; 'status') - if [ -n "${PROCESSPID}" ]; then - echo "Dynatrace $DT_PRODUCT daemon is running:" - ps -ef | grep ${DT_BINARY} | grep ${PROCESSPID} - else - echo "Dynatrace ${DT_PRODUCT} daemon not running." - fi - ;; + if [ -n "${PROCESSPID}" ]; then + echo "Dynatrace $DT_PRODUCT daemon is running:" + ps -ef | grep ${DT_BINARY} | grep ${PROCESSPID} + else + echo "Dynatrace ${DT_PRODUCT} daemon not running." + exit 1 + fi + ;; *) - echo "usage: $0 {start|stop|status}" - ;; + echo "usage: $0 {start|stop|status}" + ;; esac + +exit 0