-
-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Create mosquitto.sh * Use docker-compose to verify linux build * Use scripts/mosquitto.sh in CI github action
- Loading branch information
1 parent
d2d2ca4
commit 6f16706
Showing
5 changed files
with
97 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
#!/bin/bash | ||
|
||
CONTAINER_ID=$(docker container ls | grep eclipse-mosquitto | awk {'print $1'}) | ||
COMMAND=$1 | ||
HOME=$(dirname $0) | ||
|
||
usage() | ||
{ | ||
echo "Usage: mosquitto.sh [start] [stop] [status]" | ||
exit 2 | ||
} | ||
|
||
start() | ||
{ | ||
if [ -z "$CONTAINER_ID" ]; then | ||
docker run \ | ||
-d \ | ||
-p 1883:1883 \ | ||
-p 8883:8883 \ | ||
-p 8080:8080 \ | ||
-p 8081:8081 \ | ||
-v $(pwd)/$HOME/../mosquitto/config:/mosquitto/config \ | ||
-v $(pwd)/$HOME/../mosquitto/certs:/mosquitto/certs \ | ||
eclipse-mosquitto | ||
else | ||
echo "Mosquitto is already running" | ||
fi | ||
} | ||
|
||
stop() | ||
{ | ||
if [ -n "$CONTAINER_ID" ]; then | ||
echo "Stopping mosquitto" | ||
docker container stop "$CONTAINER_ID" | ||
docker rm "$CONTAINER_ID" | ||
else | ||
echo "Mosquitto is already stopped" | ||
fi | ||
} | ||
|
||
status() | ||
{ | ||
if [ -n "$CONTAINER_ID" ]; then | ||
echo "Mosquitto is running" | ||
else | ||
echo "Mosquitto is not running" | ||
fi | ||
} | ||
|
||
if [ "$COMMAND" == "start" ]; then | ||
start | ||
elif [ "$COMMAND" == "stop" ]; then | ||
stop | ||
elif [ "$COMMAND" == "status" ]; then | ||
status | ||
else | ||
usage | ||
exit -1 | ||
fi | ||
|