HA auto restarts every morning

@Mirai_Hayashi It is just HA. The OS is running without interruptions.
@kanga_who That is actually a great idea!
But HA is not writing the log in a file, unless it cannot start (due to invalid config).
Unless I am missing something.

Experiment with 6:24:58am, see if it catches something happening just before 6:25:00. That’s my only suggestion.

It seems like you have an automation causes the restart, or a cronjob that you can’t find, though.

My point is, what can you copy if there is nothing to copy? Can you see your log file now? Is there anything written to that file? Mine has the last time I stopped HA, changed the config and tried to start again, but the config was invalid. That was 10 days ago…

I agree with kanga…If its a system fault, I doubt that it would restart precisely at the same time everyday. There is a scheduled job or automation somewhere…maybe the job is not on HA but on some external system that has access to your server. Are you exposing your HA to the internet in any way?

Yes, the HA is log normally located in /home/homeassistant or /home/homeassistant/.homeassistant if in a venv.

It’s in the same place as where all your config files are located and is called home-assistant.log

@Mirai_Hayashi That is something I completely agree with you. I am just trying to find out what it is. Yes I have my HA exposed, but only to my mobile. I will disable access tonight and will see tomorrow what will happen.

@kanga_who I know… The file is there for me too, but its contents is 10 days ago where I had a misconfiguration. I mean, the log is stored in the database, right? IF and I capitalize IF again, you stop HA, change your config to an invalid configuration and try to start HA, ONLY THEN it will write the log file, so you can see what error came up, because you cant see it in the frontend since HA is down.

Every time there is an warning, error, an unreachable entity, etc. HA will log it to that file.

If it is not logging to that file location, I think your config is in a different folder, potentially, and therefore so is your log file. My log file updates every time an event occurs.

Thanks for the heads up! My log is located at /var/log/homeassistant

Cronjob here I come!

1 Like

Please bare with me. I have already spammed this thread a lot. I know…

Since I found my log file, I realized I dont have to cronjob it, since it already kept a copy of itself!
I created a samba share for convenience and here is what I see:

Capture

Notice the time on the home-assistant.log.1 —> 06:25 Yay!!
In fact every log back up is at the same time…
Opening the logs, I am seeing this as the last log written in every file:

2019-01-28 06:25:04 INFO (MainThread) [homeassistant.components.websocket_api.http.connection.1609406352] Connection closed by client
2019-01-28 06:25:05 INFO (Thread-20) [pywemo.subscribe] Terminated threads

This is not helpful to me… How about you guys?

EDIT:
Now… Something else came to my mind… Might be stupid, but I have to ask to exclude it from my list:
Is there a chance HA is splitting/backing up the logs and marks this behavior as a Restart?

Thank you guys for all the help. You really helped me to figure out what is going on by eliminating things.
I found what the problem is:

CREATE LOGROTATE RULE
This logrotate script at /etc/logrotate.d/homeassistant will create an outage of a few seconds every week at night. If you do not want this add --log-rotate-days 7 to the FLAGS variable in the init script.

See… I knew it had to be something stupid and there it is.