commit 036dd8c6c7898167fc90dd95f7213b985093f588 parent 91ff9e6325e9a550d0ad771ae82a05f083af592a Author: dwrz <dwrz@dwrz.net> Date: Fri, 28 Oct 2022 14:57:20 +0000 Add cameras.sh example Diffstat:
A | scripts/cameras.sh | | | 30 | ++++++++++++++++++++++++++++++ |
1 file changed, 30 insertions(+), 0 deletions(-)
diff --git a/scripts/cameras.sh b/scripts/cameras.sh @@ -0,0 +1,30 @@ +#!/bin/sh + +readonly WEBCONTROL_PORT="8080" +readonly CAMERA_1="10.0.1.1" +readonly CAMERA_2="10.0.1.2" +readonly CAMERA_3="10.0.1.3" + +err() { + echo "[$(date -u +'%Y-%m-%dT%H:%M:%S%:z')]: $*" >&2 +} + +main() { + url="detection/status" + case "$1" in + "capture"|"c") url="detection/snapshot" ;; + "pause"|"p") url="detection/pause" ;; + "start"|"s") url="detection/start" ;; + "status"|"") url="detection/status" ;; + *) err "unrecognized command: $1"; exit 1 + esac + + curl --digest --user "${MOTION_USER}:${MOTION_PASSWORD}" \ + "https://${CAMERA_1}:${WEBCONTROL_PORT}/0/${url}" + curl --digest --user "${MOTION_USER}:${MOTION_PASSWORD}" \ + "https://${CAMERA_2}:${WEBCONTROL_PORT}/0/${url}" + curl --digest --user "${MOTION_USER}:${MOTION_PASSWORD}" \ + "https://${CAMERA_3}:${WEBCONTROL_PORT}/0/${url}" +} + +main "$@"