From b3466f583fd86234cf8da32e177205a24d2bb376 Mon Sep 17 00:00:00 2001
From: Arne Baeumler <arne@br0tkasten.de>
Date: Mon, 1 May 2017 21:51:46 +0200
Subject: [PATCH] publish images to mqtt broker

---
 scripts/mqtt | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
 create mode 100644 scripts/mqtt

diff --git a/scripts/mqtt b/scripts/mqtt
new file mode 100644
index 0000000..c917afb
--- /dev/null
+++ b/scripts/mqtt
@@ -0,0 +1,19 @@
+#!/bin/sh
+
+BROKER=broker.example.com
+BASETOPIC=camera
+USERNAME=mqtt-user
+PASSWORD=mqtt-passwordsten.de
+
+CAMERA=$1
+IMAGE=$2
+
+[ "x$CAMERA" == "x" ] && echo "Usage: $0 <CAMERA> <IMAGE>" && exit 1 
+[ "x$IMAGE" == "x" ] && "Usage: $0 <CAMERA> <IMAGE>" && exit 2 
+
+/usr/bin/mosquitto_pub \
+        -h "$BROKER" \
+        -u "$USERNAME" \
+        -P "$PASSWORD" \
+        -t "$BASETOPIC/$CAMERA" \
+        -f "$IMAGE" \