I'm using a bash script on my Raspberry Pi B+ to take photos with the RaspiCam all 60 seconds and upload them to my FTP server:
#!/bin/bash
STARTDATE=$(date +"%Y-%m-%d_%H_%M_%S")
DELAY=60
echo "Camerascript started at $STARTDATE" > /home/pi/fb/$STARTDATE.txt
echo -e "Interval set to $DELAY\n" >> /home/pi/fb/$STARTDATE.txt
while [ 1 ]; do
DATE=$(date +"%Y-%m-%d_%H_%M_%S")
echo "Taking picture $DATE.jpg..." >> /home/pi/fb/$STARTDATE.txt
raspistill -q 10 -th none -o /home/pi/fb/$DATE.jpg >> /home/pi/fb/$STARTDATE.txt 2>&1
echo "Picture $DATE.jpg taken" >> /home/pi/fb/$STARTDATE.txt
curl -T /home/pi/fb/$DATE.jpg ftp://myftpserver --user myuser:mypass >> /home/pi/fb/$STARTDATE.txt 2>&1
echo "Picture $DATE.jpg uploaded" >> /home/pi/fb/$STARTDATE.txt
echo -e "Waiting $DELAY sec...\n" >> /home/pi/fb/$STARTDATE.txt
sleep $DELAY
done
This works for 3 hours and some minutes. After that, raspistill quits work. This are the corresponding entries from my log file:
Taking picture 2016-02-03_13_40_14.jpg...
mmal: Could not rename temp file to: /home/pi/fb/2016-02-03_13_40_14.jpg; No space left on device
Picture 2016-02-03_13_40_14.jpg taken
curl: Can't open '/home/pi/fb/2016-02-03_13_40_14.jpg'!
curl: try 'curl --help' or 'curl --manual' for more information
Picture 2016-02-03_13_40_14.jpg uploaded
Waiting 60 sec...
Taking picture 2016-02-03_13_41_20.jpg...
mmal: main: Error opening output file: /home/pi/fb/2016-02-03_13_41_20.jpg~
No output file will be generated
There is plenty of space left on the device /home/pi/fb/ so I don't understand why raspistill complains about that. I also don't get why raspistill is trying to save the following photos with a ~ behind the file extension.
EDIT:
This is the output of df
:
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/root 30137128 3726572 25130092 13% /
devtmpfs 185764 0 185764 0% /dev
tmpfs 190036 0 190036 0% /dev/shm
tmpfs 190036 4580 185456 3% /run
tmpfs 5120 4 5116 1% /run/lock
tmpfs 190036 0 190036 0% /sys/fs/cgroup
//192.168.178.1/FRITZ.NAS/VBTM-Store-n-Go-01 1422048 65980 1356068 5% /home/pi/fb
/dev/mmcblk0p1 61384 20296 41088 34% /boot
tmpfs 38008 0 38008 0% /run/user/1000
As I mentioned earlier, there is plenty of space left. But the error seems to be related to the fact that /home/pi/fb
is a network share. When I change the folder to a local one on my SD card the process runs for hours without complaining. Interesting is: When I restart the script it is even not able to write the "Camerascript started at..." to my log file (but it was able to write all the error messages to log for hours after raspistill stopped working...), instead echo
complains that there is "No space left on device". BUT I'm able to copy huge files to the /home/pi/fb
share without any issues.
So I guess I have to change my question to: Why is every command in my bash script complaining about to little space while every command I use outside of the script is not?
tune2fs -r
but you really should read up in theman
page first...!