#!/bin/sh
#
# tries to figure out the PID and send signal -3 to provoke a stacktrace of all threads
#

# No need to source /etc/default/svc-runner

SVCRUNNER_PID=$(systemctl show -P MainPID svc-runner.service)

if test -z "${SVCRUNNER_PID}" -o "${SVCRUNNER_PID}" = 0 ; then
  echo "ERROR: Unable to detect main PID of eventual svc-runner process."
  exit 11
fi

echo "INFO: Sending signal -3 to main PID of svc-runner, ${SVCRUNNER_PID}"
kill -3 ${SVCRUNNER_PID}

# if we want all the hoopla from osgi-runner-dump someone has to "port" that

echo "GOOD: Back from sending signal -3 to main PID of svc-runner, ${SVCRUNNER_PID}"

exit 0

