Fswebcam cron: device or resource busy

I am trying to get a webcam snapshot on a Raspberry Pi every minute. So I wrote a script:

NOW=$(date +"%H-%M-%S") fswebcam -r 640x480 /home/pi/$NOW.jpg

When I run it on the command line, for example /home/pi/webcam_script

, it works fine. Then I add the task to cron with crontab -e

:

0-59 * * * * /home/pi/webcam_script >> cronlog 2>&1

      

As a result, no pictures will be taken. The file cronlog

displays the following error message:

Error selecting input 0
VIDIOC_S_INPUT: Device or resource busy

      

So what is wrong and how can I automatically get images from the webcam

+3


source to share





All Articles