28 lines
599 B
Bash
28 lines
599 B
Bash
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
echo "INFO: stopping WSL local EMQX service"
|
|
|
|
if ! command -v systemctl >/dev/null 2>&1; then
|
|
echo "FAIL: systemctl not found; stop EMQX manually in this WSL environment"
|
|
exit 1
|
|
fi
|
|
|
|
if ! dpkg-query -W emqx >/dev/null 2>&1; then
|
|
echo "FAIL: emqx package not found; nothing to stop"
|
|
exit 1
|
|
fi
|
|
|
|
if ! systemctl is-active --quiet emqx; then
|
|
echo "PASS: emqx service already inactive"
|
|
exit 0
|
|
fi
|
|
|
|
sudo systemctl stop emqx
|
|
if systemctl is-active --quiet emqx; then
|
|
echo "FAIL: emqx service is still active"
|
|
exit 1
|
|
fi
|
|
|
|
echo "PASS: emqx service stopped"
|