diff --git a/deploy/packages/deb/debian/postinst b/deploy/packages/deb/debian/postinst index 1a8dd3be8..69936cbe0 100755 --- a/deploy/packages/deb/debian/postinst +++ b/deploy/packages/deb/debian/postinst @@ -35,6 +35,12 @@ chmod -R 0755 /usr/lib/emqx/bin ln -s /usr/lib/emqx/bin/emqx /usr/bin/emqx ln -s /usr/lib/emqx/bin/emqx_ctl /usr/bin/emqx_ctl +if systemctl status --no-pager; then + systemctl enable emqx; +else + echo "systemd is not in use, skip enable emqx" +fi + case "$1" in configure) ;; diff --git a/deploy/packages/deb/debian/postrm b/deploy/packages/deb/debian/postrm index caea4a520..affb2f4cc 100755 --- a/deploy/packages/deb/debian/postrm +++ b/deploy/packages/deb/debian/postrm @@ -55,6 +55,11 @@ case "$1" in if [ -d /usr/lib/emqx ]; then rm -r /usr/lib/emqx fi + + if pidof systemd; then + systemctl disable emqx; + rm -f /etc/systemd/emqx.service + fi ;; remove)