postinst.sh 642 B

12345678910111213141516171819
  1. #!/bin/sh
  2. set -e
  3. # Restart systemd service if it was already running. Note that "deb-systemd-invoke try-restart" will
  4. # only act if the service is already running. If it's not running, it's a no-op.
  5. #
  6. # TODO: This is only tested on Debian.
  7. #
  8. if [ "$1" = "configure" ] && [ -d /run/systemd/system ]; then
  9. systemctl --system daemon-reload >/dev/null || true
  10. if systemctl is-active -q ntfy.service; then
  11. echo "Restarting ntfy.service ..."
  12. if [ -x /usr/bin/deb-systemd-invoke ]; then
  13. deb-systemd-invoke try-restart ntfy.service >/dev/null || true
  14. else
  15. systemctl restart ntfy.service >/dev/null || true
  16. fi
  17. fi
  18. fi