cameras (857B)
1 #!/usr/bin/env bash 2 3 readonly WEBCONTROL_PORT="${PORT_CONTROL}" 4 5 readonly cameras=( 6 "https://${HOST0}:${WEBCONTROL_PORT}/0" 7 # "https://${HOST0}:${WEBCONTROL_PORT}/1" 8 # "https://${HOST1}:${WEBCONTROL_PORT}/${CAMERA0}" 9 # "https://${HOST2}:${WEBCONTROL_PORT}/${CAMERA0}" 10 ) 11 readonly auth=( 12 "${MOTION_USER}:${MOTION_PASSWORD}" 13 # "${USER0}:${PW0}" 14 # "${USER1}:${PW1}" 15 # "${USER2}:${PW2}" 16 ) 17 18 err() { 19 echo "[$(date -u +'%Y-%m-%dT%H:%M:%S%:z')]: $*" >&2 20 } 21 22 main() { 23 local url="detection/status" 24 25 case "$1" in 26 "capture"|"c") url="detection/snapshot" ;; 27 "pause"|"p") url="detection/pause" ;; 28 "start"|"s") url="detection/start" ;; 29 "status"|"") url="detection/status" ;; 30 *) err "unrecognized command: $1"; exit 1 31 esac 32 33 for i in "${!cameras[@]}"; do 34 curl --digest --user "${auth[i]}" "${cameras[i]}/${url}" 35 done 36 } 37 38 main "$@"