~voidraven/s4

969ff415f363980f4309f979fc4518f04528ffbf — lotus 2 years ago b3b5702
removed dependency on entr, updated readme accordingly
2 files changed, 11 insertions(+), 3 deletions(-)

M .s4/watch.sh
M README.md
M .s4/watch.sh => .s4/watch.sh +10 -1
@@ 106,7 106,16 @@ if [ -d $STORAGE/s4 ] ; then
    # where is this script running from?
    THIS_PWD=$(dirname $0)
    # watch the status file for changes, if it changes, re-run this script..
    echo "$STORAGE/s4/cameras/$ID/run.status" | entr -p "$THIS_PWD/watch$ID.sh" check &
    LAST_STATUS=$(cat $STORAGE/s4/cameras/$ID/run.status)

    while true ; do
	sleep 1
	GRAB_STATUS=$(cat $STORAGE/s4/cameras/$ID/run.status)
	if [ "$GRAB_STATUS" != "$LAST_STATUS" ] ; then
	    LAST_STATUS=$GRAB_STATUS
	    $THIS_PWD/watch$ID.sh check & # makes a recursive background call
	fi
    done & # background the loop

    # Lets start keeping track of the time!
    CUR_HOUR=$(date +"%H")

M README.md => README.md +1 -2
@@ 4,12 4,11 @@

Orchestrate and automate handling multiple webcams as security cameras. I had several webcams lying around and wanted a way to easily keep recordings going in a predictable manner. We rely on a common shared storage (NAS) to handle communication between the cameras. In my case I have several networked computers around the house, this allowed me to simply connect up a webcam and I have everything I need.

The idea for this tool is simple. Each computer periodically checks the NAS to see if it needs to start or stop recording (*via entr*). There is no master controller. As long as you have access to the storage, you have access to control the cameras. One script per camera+computer has to be installed. For instance if you have 4 computers with cameras you want running, each of them will need a watchN.sh script installed.
The idea for this tool is simple. Each computer periodically (every second) checks the NAS to see if it needs to start or stop recording. There is no master controller. As long as you have access to the storage, you have access to control the cameras. One script per camera+computer has to be installed. For instance if you have 4 computers with cameras you want running, each of them will need a watchN.sh script installed.


### Dependencies
- [ffmpeg](https://ffmpeg.org/download.html)
- [entr](http://eradman.com/entrproject/)
- [ed](https://www.gnu.org/software/ed/manual/ed_manual.html)
- cron
- POSIX make