I know it is not part of motion, as I have stated above it is taken from your tutorial page...
Unfortunately it has not left the last snapshots...
It rather seems like every time it runs it deletes the last 6 snapshots (i.e. those created the last hour) rather than the oldest snapshots....
I have posted a part of the /tmp/images_deleted logfile in the comment to your tutorial.
The log confirms that the cron job deletes the latest snapshots to bring the list down to 20 files instead of deleting the oldest snapshots...
For clarity I also post that extract here:
Code: Select all
Tue Feb 17 21:15:01 CET 2015
removed `/var/www/webcam/20150217202000-snapshot.jpg'
removed `/var/www/webcam/20150217203000-snapshot.jpg'
removed `/var/www/webcam/20150217204000-snapshot.jpg'
removed `/var/www/webcam/20150217205000-snapshot.jpg'
removed `/var/www/webcam/20150217210000-snapshot.jpg'
removed `/var/www/webcam/20150217211000-snapshot.jpg'
Tue Feb 17 22:15:01 CET 2015
removed `/var/www/webcam/20150217212000-snapshot.jpg'
removed `/var/www/webcam/20150217213000-snapshot.jpg'
removed `/var/www/webcam/20150217214000-snapshot.jpg'
removed `/var/www/webcam/20150217215000-snapshot.jpg'
removed `/var/www/webcam/20150217220000-snapshot.jpg'
removed `/var/www/webcam/20150217221000-snapshot.jpg'
Tue Feb 17 23:15:01 CET 2015
removed `/var/www/webcam/20150217222000-snapshot.jpg'
removed `/var/www/webcam/20150217223000-snapshot.jpg'
removed `/var/www/webcam/20150217224000-snapshot.jpg'
removed `/var/www/webcam/20150217225000-snapshot.jpg'
removed `/var/www/webcam/20150217230000-snapshot.jpg'
removed `/var/www/webcam/20150217231000-snapshot.jpg'
The ls command that is part of the script must be listing the files in the opposite direction timewise from what is assumed by using tail...
EDIT:
No the listing order is not the culprit! I did a quick test:
Code: Select all
pi@raspbian-pi /var/www/webcam $ ls *snapshot.jpg > snapshots
pi@raspbian-pi /var/www/webcam $ cat snapshots
20150217122000-snapshot.jpg
20150217123000-snapshot.jpg
20150217124000-snapshot.jpg
20150217125000-snapshot.jpg
20150217130000-snapshot.jpg
20150217131000-snapshot.jpg
20150217132000-snapshot.jpg
20150217133000-snapshot.jpg
20150217134000-snapshot.jpg
20150217135000-snapshot.jpg
20150217140000-snapshot.jpg
20150217141000-snapshot.jpg
20150217142000-snapshot.jpg
20150217143000-snapshot.jpg
20150217144000-snapshot.jpg
20150217145000-snapshot.jpg
20150217150000-snapshot.jpg
20150217151000-snapshot.jpg
20150217152000-snapshot.jpg
20150217232000-snapshot.jpg
20150217233000-snapshot.jpg
20150217234000-snapshot.jpg
pi@raspbian-pi /var/www/webcam $
So this confirms that the most recent files are at the bottom of the ls list.
Very strange why the cron is working the way it is....
EDIT2:
Now I have tested various listing commands and this seems to list the oldest files rather than the newest ones:
Now I just have to find out how I can change the cron job....