shutdown/restart Homeassistant recorder/sqlite #294

Closed
opened 3 months ago by jump · 4 comments
jump commented 3 months ago

Is there a way to shutdown or restart the Homeassistance instance without start-stop-daemon? Restarting the instance in the frontend (Developer Tools/Restart) leads to a crashed openrc daemon.

Linked to this issue is the error logged by recorder

The system could not validate that the sqlite3 database was shutdown cleanly

To prevent this error I had to modify the init script to set a recorder end time in the sqlite database (vacuum is only for compression).

stop() {
        ebegin "Stopping ${RC_SVCNAME}"
        start-stop-daemon --stop --signal USR1 --pidfile /var/run/${RC_SVCNAME}.pid
	sleep 3
	/usr/bin/sqlite3 /etc/homeassistant/home-assistant_v2.db "UPDATE recorder_runs SET end=(datetime('now','localtime')) ORDER BY start DESC LIMIT 1"
	/usr/bin/sqlite3 /etc/homeassistant/home-assistant_v2.db "VACUUM"
        eend

Is there a way to shutdown or restart the Homeassistance instance without start-stop-daemon? Restarting the instance in the frontend (Developer Tools/Restart) leads to a crashed openrc daemon. Linked to this issue is the error logged by recorder ``` The system could not validate that the sqlite3 database was shutdown cleanly ``` To prevent this error I had to modify the init script to set a recorder end time in the sqlite database (vacuum is only for compression). ``` stop() { ebegin "Stopping ${RC_SVCNAME}" start-stop-daemon --stop --signal USR1 --pidfile /var/run/${RC_SVCNAME}.pid sleep 3 /usr/bin/sqlite3 /etc/homeassistant/home-assistant_v2.db "UPDATE recorder_runs SET end=(datetime('now','localtime')) ORDER BY start DESC LIMIT 1" /usr/bin/sqlite3 /etc/homeassistant/home-assistant_v2.db "VACUUM" eend ```
onkelbeh self-assigned this 3 months ago
Owner

Looks like #260, never had a problem like that because my recorder writes to a mariadb. We could take it into the regular init controlled by a UseFlag.

Looks like #260, never had a problem like that because my recorder writes to a mariadb. We could take it into the regular init controlled by a UseFlag.
Owner
Also mentioned in https://github.com/home-assistant/core/issues/73679
Owner

Again I would recommend to use MariaDB.

Again I would recommend to use MariaDB.
Poster

My sqlite database grows more or less 3MB per week after sqlite/vakuum. Because my Mysql databases are on an encrypted volume and not available after a power loss I`ll stay with sqlite for the moment.

My sqlite database grows more or less 3MB per week after sqlite/vakuum. Because my Mysql databases are on an encrypted volume and not available after a power loss I`ll stay with sqlite for the moment.
jump closed this issue 2 months ago
Sign in to join this conversation.
No Milestone
No Assignees
2 Participants
Notifications
Due Date

No due date set.

Dependencies

No dependencies set.

Reference: onkelbeh/HomeAssistantRepository#294
Loading…
There is no content yet.