26 lines
626 B
Bash
26 lines
626 B
Bash
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
echo "INFO: starting WSL local EMQX service"
|
|
|
|
if ! command -v systemctl >/dev/null 2>&1; then
|
|
echo "FAIL: systemctl not found; start 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; this script does not install or reset EMQX"
|
|
exit 1
|
|
fi
|
|
|
|
if systemctl is-active --quiet emqx; then
|
|
echo "PASS: emqx service already active"
|
|
exit 0
|
|
fi
|
|
|
|
sudo systemctl start emqx
|
|
systemctl is-active --quiet emqx && echo "PASS: emqx service active" || {
|
|
echo "FAIL: emqx service did not become active"
|
|
exit 1
|
|
}
|