Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion ambari-metrics-grafana/conf/unix/ambari-metrics-grafana
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,22 @@ fi
DAEMON_OPTS="--pidfile=${PID_FILE} --config=${CONF_FILE} cfg:default.paths.data=${DATA_DIR} cfg:default.paths.logs=${LOG_DIR}"

function isRunning() {
test -e "$PID_FILE"
if [ -f ${PID_FILE} ]; then
PID=`cat ${PID_FILE}`
if [ -z "`ps ax -o pid | grep -w ${PID}`" ]; then
echo "${PID_FILE} found with no process. Removing ${PID}..."
rm -f ${PID_FILE}
return 1
else
tput bold
echo "WARN: Grafana already running with PID: ${PID}"
tput sgr0
echo "Exiting."
return 0
fi
else
return 1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a case where the PID file does not exist, but the process is still running.

fi
}

case "$1" in
Expand Down