X10 Community Forum

📱🖥️PiX10Hub => 💬General Discussion => Topic started by: LostDog88 on March 01, 2019, 01:07:32 PM

Title: Re: Pi DST is coming....
Post by: LostDog88 on March 01, 2019, 01:07:32 PM
I googled how to reboot at midnight.
Seems my pi likes to be rebooted every 5 to 6 or so days anyways.
I set mine to reboot every morning at 3AM.

The last DST I was one day off and it is my understanding that the pi does it's clock update at 12AM. Since DST actually happens at 2AM and there is no RTC built into the PI the system clock won't update until the next day.

Rebooting at 3AM solves this issue.

I hope.

We shall see! LOL
Title: Re: Re: Pi DST is coming....
Post by: petera on March 01, 2019, 03:33:42 PM
I googled how to reboot at midnight.
Seems my pi likes to be rebooted every 5 to 6 or so days anyways.
I set mine to reboot every morning at 3AM.

The last DST I was one day off and it is my understanding that the pi does it's clock update at 12AM. Since DST actually happens at 2AM and there is no RTC built into the PI the system clock won't update until the next day.

Rebooting at 3AM solves this issue.

Problem solved by setting up an NTP server. You can have that NTP server sync all devices on your LAN too.

I'm puzzled by the need to reboot the Pi every night too. Why do you need to do this. I've noticed a few who seem to have the need to do this too. Servers only need to be rebooted for maintenance purposes.

Are you running unstable software on it.

I hope.

We shall see! LOL
Title: Re: Re: Pi DST is coming....
Post by: LostDog88 on March 01, 2019, 03:53:42 PM
I googled how to reboot at midnight.
Seems my pi likes to be rebooted every 5 to 6 or so days anyways.
I set mine to reboot every morning at 3AM.

The last DST I was one day off and it is my understanding that the pi does it's clock update at 12AM. Since DST actually happens at 2AM and there is no RTC built into the PI the system clock won't update until the next day.

Rebooting at 3AM solves this issue.

Problem solved by setting up an NTP server. You can have that NTP server sync all devices on your LAN too.

I'm puzzled by the need to reboot the Pi every night too. Why do you need to do this. I've noticed a few who seem to have the need to do this too. Servers only need to be rebooted for maintenance purposes.

Are you running unstable software on it.

I hope.

We shall see! LOL

Nope......Not running anything but stable. HomeGenie v1.2 - Stable.38. Straight from the maintenance page.

Two mornings in a row I have woke up and automation had failed. I quickly open putty and am able to log into the Pi no issues at all.

I then open a browser and navigate to Home Genie. Nothing. 401 does not exist error. sudo reboot now and the pi reboots very quickly and HomeGenie returns to working status.

So. Since I am gone an awful lot and my vacation scenes are important to me, the only solution I had was to reboot every night.

Hence the reason for google and a cron tab thingy.
Title: Re: Re: Pi DST is coming....
Post by: petera on March 01, 2019, 05:50:40 PM
The word HomeGenie Stable doesn't apply in your case so.

Did you check the Raspberry Pi logs to find the cause.
Title: Re: Re: Pi DST is coming....
Post by: petera on March 01, 2019, 06:02:26 PM
Before you rebooted did you sudo systemctl status homegenie.service to find the reason why the service halted

Just add the line Restart=always into your homegenie.service file and never again will you have to reboot your HG Raspberry Pi

To do this just sudo nano /etc/systemd/system/homegenie.service and add the above line under the [Service] section press ctrl x and you're done forever.

No more messy cron jobs now.
Title: Re: Re: Pi DST is coming....
Post by: LostDog88 on March 02, 2019, 12:37:11 PM
The word HomeGenie Stable doesn't apply in your case so.

Did you check the Raspberry Pi logs to find the cause.

I am not a linux guru. I would not have the faintest clue on how to do this.

I know this much. System stops every so often. My limited knowledge knows it has to be rebooted to get the system to work as desired.

Rebooting system solves the issue. Wife happy buttons on remote work. Every one including cats and dogs live happily ever after!  rofl rofl rofl rofl
Title: Re: Re: Pi DST is coming....
Post by: petera on March 02, 2019, 01:51:36 PM
The word HomeGenie Stable doesn't apply in your case so.

Did you check the Raspberry Pi logs to find the cause.

I am not a linux guru. I would not have the faintest clue on how to do this.

I know this much. System stops every so often. My limited knowledge knows it has to be rebooted to get the system to work as desired.

Rebooting system solves the issue. Wife happy buttons on remote work. Every one including cats and dogs live happily ever after!  rofl rofl rofl rofl

That simple line I gave you added to your homegenie.service file along with the instruction on how to do it will restart the service (in other words restart homegenie automatically) anytime it stops.

You do not need to be a Linux guru or any other type of guru to do this. If Homegenie is crashing as you described it is not set up properly in the first place.

Imagine turning off and on your freezer every night at midnight to prevent it from going in to a defrost cycle. You'd soon be calling the maintenance guy to sort the problem.

Servers are designed to run unassisted 24/7 unless they are powered down for maintenance.

A number of other commercial home automation applications on the market which are poorly designed and suffer from memory leaks encourage their user base to reboot their servers regularly. Lazy designers and silly users for tolerating poor design and paying for the privilege to do so.

By all means keep rebooting nightly but it's only a matter of time before the server sits down permanently unless the underlying need for rebooting nightly is addressed.
Title: Re: Re: Pi DST is coming....
Post by: Dave Mc on March 03, 2019, 03:46:39 AM
Just add the line Restart=always into your homegenie.service file and never again will you have to reboot your HG Raspberry Pi

To do this just sudo nano /etc/systemd/system/homegenie.service and add the above line under the [Service] section press ctrl x and you're done forever.

No more messy cron jobs now.

Is this something that could/should be added to the PiX10Hub image for everyone's convenience?
Title: Re: Re: Pi DST is coming....
Post by: petera on March 03, 2019, 08:23:02 AM
Just add the line Restart=always into your homegenie.service file and never again will you have to reboot your HG Raspberry Pi

To do this just sudo nano /etc/systemd/system/homegenie.service and add the above line under the [Service] section press ctrl x and you're done forever.

No more messy cron jobs now.

.
Is this something that could/should be added to the PiX10Hub image for everyone's convenience?

You can add it yourself

sudo systemctl stop homegenie.service
sudo nano /etc/systemd/system/homegenie.service

You'll see your service file. Move to the [Service] section and under that heading just add the line

restart=always

When that is done press ctrl x and enter. Press y and enter and problem solved. To restart HG just type

sudo systemctl start homegenie.service
Title: Re: Re: Pi DST is coming....
Post by: Tuicemen on March 03, 2019, 02:18:47 PM
Adding the line your self would be a lot more simple then reinstalling a Pi image and reloading your HG backup.
Title: Re: Re: Pi DST is coming....
Post by: Dave Mc on March 04, 2019, 04:18:31 AM
That is fine with me.  I was thinking more about future users so it would be included in the image.
Title: Re: Re: Pi DST is coming....
Post by: petera on March 04, 2019, 05:56:00 AM
That is fine with me.  I was thinking more about future users so it would be included in the image.

Most of these type of changes are just minor tweaks and can be easily carried out locally.

More pressing would be the need to address the issue of a user having to reboot the server on a nightly basis. This is a stability issue and needs to be investigated if not for the user in question certainly for the rest of the user base. In this users case HG will eventually stop functioning permanently.

As I mentioned earlier, should HG stop functioning a simple command sudo systemctl status homegenie.service will give an indication what caused this crash. The results can be reported to the Homegenie Club forum or the Homegenie GitHub and can be investigated further and a solution provided
Title: Re: Pi DST is coming....
Post by: Tuicemen on March 22, 2019, 09:43:25 AM
You can reset your PiX10Hub time with some simple terminal commands, you'd type:
Code: [Select]
sudo timedatectl set-ntp truefollowed by
Code: [Select]
date or for more detail
Code: [Select]
timedatectl status
you could then create a script to do this and a cron job to fire the script when you wished to update the time. Every day at 2:01 am or just when DST & Standard Time starts.
I've started to create some programs that perform terminal tasks from inside HG, this may be one I should look at creating.
Unless someone beats me to it. ;) ;)
 >!
Title: Re: Pi DST is coming....
Post by: bkenobi on March 22, 2019, 10:59:16 AM
I'm with petera on this.  If the RPi or HG are not stable and require any regular reboot or other tweaking, they are not stable and need to be fixed.  Adding a reboot is a band-aid that is covering up a real problem that should be fixed.  If the HG release is broken, Gene needs to know so that it can be fixed.  If the RPi has some system issue with the installation, it must be sorted out.  This is not the right solution for a "Hub".  If all people want is a toy, then continue with the reboot approach but you will never have a reliable system if you do it that way.

FWIW, I found a similar issue when using the HG-BE image on RPi.  That fork was aimed more so at Windows users so running on RPi was more experimental.  In the end, it was not a good choice for my setup at the time so I did not deploy it.
Title: Re: Pi DST is coming....
Post by: LostDog88 on March 22, 2019, 11:49:23 AM
I do not want to make anyone mad here, I enjoy this board, and love the (free) support that I get.
With that being said, it also needs to be noted that I am NOT a linux person. I am learning. I am trying. But it is a new language and I am old.
In my 30 years of playing, fixing, repairing, etc. computers I have never ever ever met one that never needed to be rebooted. The OP was about a problem with DST. There was also an issue where once in a while, randomly my system would stop responding and need to be rebooted. This was rare, but it seemed to happen randomly and almost always when I was out of town.
I did what I thought was a good idea and set it to reboot every evening. After the DST and any other changes that would happen between 12AM and 2AM. I don't think there is an issue with my system and I certainly wouldn't refer to it as a toy. It literally controls everything in my house. Literally. From my fish tank to my outside lights, to my chicken watering solution. Everything.
I have been programming phone system back to when they used clappers, springs and 25 pair cables. Once electro-mechanical went away and systems became more electrical that is when the issues started. A 1A2 key system never needed rebooting. Even the most robust Norstar system needed a reboot once in a while. While not often, every tech knew to reboot it if there was a major problem with the system. This is just how it was/is. And still stands true today.
While Linux is much more robust than windows, I still think that once in a while it will need a reboot.
I thought I had a great idea. Apparently I was wrong. But there is no way I am smart enough or experienced enough to fix what I cannot figure out. And trying to get support over a board is well..........support over a board. :-)
All computers are built by humans. Software is built by humans. Every human is flawed. This shows up in our software and hardware.
I want to be helpful here and I want to learn, but I just don't have the skills to "fix" everything. And with so many modules, scripts, etc. It is time consuming. Sometimes I just have to do what is best for my situation.
Rebooting a server is not a bad thing. In my humble opinion.
Again, just trying to convey thoughts, please by all means help me. I welcome it. I encourage it. I want to learn. But I lack the skills. Again I don't want to P anyone off. I was simply trying to convey what I did to solve a problem and kill two birds. Fixing DST issue, which by the way I didn't have an issue with this time and making sure my system was fresh every day to take care of my animals and wife.
Please don't tell my wife I put her in the same category as chickens and fish and cats, she will kill me. No seriously, she will.
Title: Re: Pi DST is coming....
Post by: Tuicemen on March 22, 2019, 12:01:09 PM
LostDog88 I don't believe you've made anyone mad.
Suggestions were offered to hopefully fix the need for a reboot everyday.

I also believe periodic reboots are required. I also had to set a cron job to reboot my pi 3b+ when I initially set it up. This was due to the fact it was a new board and the OS for it was just released. A
Code: [Select]
sudo apt update && sudo apt upgrade from the terminal fixed that. So if you've not performed a update/upgrade yet I highly recommend it as the OS gets update regularly. However do it while you can watch the output as it will require some input from you.
Title: Re: Pi DST is coming....
Post by: bkenobi on March 22, 2019, 03:23:37 PM
My comment was not intended as an attack, but that appears to be the way it was taken.  I was trying to point out that if a server/hub (meaning it should be un-managed and continue functioning over a long period of time) requires regular rebooting due to a problem with the way it's put together (hardware, software, drivers, etc), then the solution for the developer is to fix the problem.  Writing a script to reboot is somewhat akin to putting electrical tape over the CEL on your car's dash so you don't see that the car has a problem.  Ignoring it may be ok for a short time, but eventually it will likely lead to other issues.

The reason tech support tells users to reboot is that they know 90% of the time they won't be able to fix the real problem, so they ask for the customer to clear the error making it "fixed".  I was first line phone support for my campus network in the 90's when people who didn't know anything about computers were just showing up to school and that was in the guide for how to help.  The next question was "is the network cable plugged in?"

If you just want it to work for a few hours at a time between reboots, nightly reboots will suffice.  But, I've had an RPi running for months without issue (2 actually).  The only reason for reboots was power issues or tinkering with configs/installing software/etc.
Title: Re: Pi DST is coming....
Post by: LostDog88 on March 23, 2019, 04:59:58 PM
This isn't a need to reboot every day.

It is random. Sometimes it works for weeks. Maybe a few days. I didn't realize that changing things on the Pi might be the reason it needed rebooting. But then again sometimes I wake up in the morning and it just don't work. Everything says it is running but there is no web page to visit. The dreaded 404 error.
To alleviate any issues while I am not here or out of country. I just tell it to reboot. At night. Not because it needs to be rebooted. Just to remove any issues. Including any I created.