vigil

Security camera system built on motion and yolov7.
git clone git://code.dwrz.net/vigil
Log | Files | Refs

cameras.sh (840B)


      1 #!/bin/sh
      2 
      3 readonly WEBCONTROL_PORT="8080"
      4 readonly CAMERA_1="10.0.1.1"
      5 readonly CAMERA_2="10.0.1.2"
      6 readonly CAMERA_3="10.0.1.3"
      7 
      8 err() {
      9   echo "[$(date -u +'%Y-%m-%dT%H:%M:%S%:z')]: $*" >&2
     10 }
     11 
     12 main() {
     13   url="detection/status"
     14   case "$1" in
     15     "capture"|"c") url="detection/snapshot" ;;
     16     "pause"|"p") url="detection/pause" ;;
     17     "start"|"s") url="detection/start" ;;
     18     "status"|"") url="detection/status" ;;
     19     *) err "unrecognized command: $1"; exit 1
     20   esac
     21 
     22   curl --digest --user "${MOTION_USER}:${MOTION_PASSWORD}" \
     23        "https://${CAMERA_1}:${WEBCONTROL_PORT}/0/${url}"
     24   curl --digest --user "${MOTION_USER}:${MOTION_PASSWORD}" \
     25        "https://${CAMERA_2}:${WEBCONTROL_PORT}/0/${url}"
     26   curl --digest --user "${MOTION_USER}:${MOTION_PASSWORD}" \
     27        "https://${CAMERA_3}:${WEBCONTROL_PORT}/0/${url}"
     28 }
     29 
     30 main "$@"