Database maintenance
This How-to applies to:
0.1
This How-to is intended for:
End User
How to keep your database clean
Every night you will need to trim excess images from your system, this will be a relatively painful exercise for your server so you probably want to do this once everyone's finished for the night.
You will also need to modify it slightly based on the number of cameras you have and their respective numbers ...
#!/bin/bash
df
cat <<EOF | mysql
use axis;
select count(*) from camera_1 where timestampdiff(hour,stamp,now()) > 70;
select count(*) from camera_101 where timestampdiff(hour,stamp,now()) > 34;
delete from camera_1 where timestampdiff(hour,stamp,now()) > 70;
delete from camera_101 where timestampdiff(hour,stamp,now()) > 34;
optimize table camera_1;
optimize table camera_101;
EOF
If you don't optimise the table, you will find that the database grows over time and becomes unmanageable.
