#!/bin/bash

sleep 5
if ! (set -o noclobber ; echo > /tmp/camera.lock) ; then
    echo "camera lock exists already..."
    exit 1  # the global.lock already exists
fi

DATE=$(date +"%Y-%m-%d_%H%M")
raspistill -o /home/pi/camera/images/high_$DATE.jpg

rm -rf /tmp/camera.lock

