I wrote a bash script that uses the dropbox app as per RaspiTV. I am using a standard USB webcam and streamer to capture videos of my cat when I am away from home with the hope that these can be uploaded to my dropbox account.
the script that does this and works just fine when run manually is:
#!/bin/bash
streamer -t 0:0:15 -c /dev/video0 -f rgb24 -r 3 -o /home/pi/Downloads/$(date +%m%d_%H%M%S).avi
#echo
fn=`echo $(ls *.avi -t | head -n1)`
echo $fn
/home/pi/Dropbox-Uploader/./dropbox_uploader.sh upload $fn /catcamFolder
Where catcamFolder
is my folder on Dropbox where the .avi files are deposited.
When I run my script manually from command line such as: ./myscript.sh
, it runs beautifully and I have the video file depo'd in my dropbox.
However, when I try to cron it using the following crontab -e
script, nothing happens, the file is neither generated not deposited in dropbox:
1,15,30,34,45 7-21 * * * /home/pi/Downloads/myscript.sh
So... this crontab line runs myscript.sh
at minute 1,15,34,45 from 7am-9pm every day.
What am I doing wrong that the script doesn't run through cron but runs fine by itself? I hope I get help so that I can keep an eye on my feline friend!
By the way, the line of bash script: fn=echo $(ls *.avi -t | head -n1)
provides the name of the most recent .avi file. This bit of useful information was from another SE