commit 21cc65ec7b7397bb6ee9a697834f57054a1dde3d 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 | | | 31 | +++++++++++++++++++++++++++++++ |
1 file changed, 31 insertions(+), 0 deletions(-)
diff --git a/scripts/cameras.sh b/scripts/cameras.sh @@ -0,0 +1,31 @@ +#!/bin/sh + +readonly WEBCONTROL_PORT="8080" +readonly CAMERA_1="10.0.0.101" +readonly CAMERA_2="10.0.0.102" +readonly CAMERA_3="10.0.0.103" + + +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 "$@"