And?
how can i use this code:
cat > /etc/cron.daily/traccar-clear-database << EOF
#!/bin/bash
result=""
while [[ "$result" != *" 0 rows affected"* ]]; do
result=$(mysql -u root -proot traccar -vve "DELETE FROM tc_positions WHERE fixTime < DATE(DATE_ADD(NOW(), INTERVAL -7 DAY)) AND id NOT IN (SELECT positionId FROM tc_devices WHERE positionid IS NOT NULL) LIMIT 10000")
sleep 1
done
result=""
while [[ "$result" != *" 0 rows affected"* ]]; do
result=$(mysql -u root -proot traccar -vve "DELETE FROM tc_events WHERE eventTime < DATE(DATE_ADD(NOW(), INTERVAL -7 DAY)) LIMIT 10000")
sleep 1
done
EOF
chmod +x /etc/cron.daily/traccar-clear-database
i receive
mysql: [Warning] Using a password on the command line interface can be insecure.
mysql: [Warning] Using a password on the command line interface can be insecure.
I don't understand the problem. You run the code. Those warnings are expected. What is the issue exactly?
Hi Anton i am also facing this same issue, I agree that this warning message is as expected but it is not clearing db as well and there is no error message displayed apart from this.
i have apporx 1000 devices and it is using 250GB diskspace and MySQL size is 174GB /var/lib/mysql
I tried to follow all instructions as mentioned on traccar clear history page.
Please guide what can be wrong with it
What makes you think it's not clearing the database?
There are few things which made me think it is not clearing db
So i think there is something wrong i am doing
Deleting records won't free up disk space.
Mysql is locally hosted on digital ocean and i need to upgrade storage in every few weeks and it is endless.
What do you mean by deleting records wont free up space? Then how should i free up space?
Deleting will free space inside the database file, but you won't see the actual file shrink. That won't happen.
i receive this message ?