#!/bin/bash # this script only makes sense if there is a good people counter installed if [ "$1" = "closed" ] && [ "$2" = "open" ] then p="$(tail -1 /run/peoplecounter)" if [ "$p" != "0" ] then logger $(basename $0) There are $p people, closed door from inside. Waiting 1 min. sleep 60 p="$(tail -1 /run/peoplecounter)" if [ "$p" = "0" ] then logger $(basename $0) There are $p people, after 1 min wait. All OK. else logger $(basename $0) There are $p people, after 1 min. Maybe ALARM fi else logger $(basename $0) There are $p people, correctly closed door from outside. All OK. fi & fi