Properly handle systemd start/stop during Debian package install, closes #30
This commit is contained in:
parent
07a1fe3acb
commit
6fbbb0c7b5
4 changed files with 38 additions and 3 deletions
19
scripts/postinst.sh
Executable file
19
scripts/postinst.sh
Executable file
|
@ -0,0 +1,19 @@
|
|||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
# Restart systemd service if it was already running. Note that "deb-systemd-invoke try-restart" will
|
||||
# only act if the service is already running. If it's not running, it's a no-op.
|
||||
#
|
||||
# TODO: This is only tested on Debian.
|
||||
#
|
||||
if [ "$1" = "configure" ] && [ -d /run/systemd/system ]; then
|
||||
systemctl --system daemon-reload >/dev/null || true
|
||||
if systemctl is-active -q ntfy.service; then
|
||||
echo "Restarting ntfy.service ..."
|
||||
if [ -x /usr/bin/deb-systemd-invoke ]; then
|
||||
deb-systemd-invoke try-restart ntfy.service >/dev/null || true
|
||||
else
|
||||
systemctl restart ntfy.service >/dev/null || true
|
||||
fi
|
||||
fi
|
||||
fi
|
Loading…
Add table
Add a link
Reference in a new issue