#! /bin/bash

if pidof SysdbMonitor; then
   rm /etc/ProcMgr.d/run/ownedByLauncher/SysdbMonitor
   # Since systemd knows we're shutting down, we cannot
   # run service ProcMgr reload; tell ProcMgr directly
   # to reload instead.
   output=`ProcMgr reload`
   if [ $? -ne 0 ]; then
      logger "$output"
   fi
   
   count=0
   while pidof SysdbMonitor; do
     sleep 1
     ((count=count+1))
     if [ $count -ge 30 ]; then
	logger "Timed out waiting for SysdbMonitor to die"
	break
     fi
   done
fi
