#!/bin/sh

if [ "$1" = "failed-upgrade" ] || [ "$1" = "remove" ] ; then
  if [ -d '/run/systemd/system' ] ; then
    # Using systemd
    systemctl --no-reload disable puppetdb.service > /dev/null 2>&1 || :
    systemctl stop puppetdb.service > /dev/null 2>&1 || :
  fi
fi
