R526 and auto program restart

There is a version r526 on Bounz’s site and on the HG site, I notice the debs are different sizes, are they the same?

Please tell me more about “Auto-restart programs after crashes”

Thanks

Hi Claton,

Yes, these versions are different, because I published my r526 much earlier than Gene his. But the “auto-restart crashed program” feature was not merged into the master branch of Gene’s repository. I think this feature will be released sometime with other changes and improvements from Gene.
But if you need I can build another version of HG based on Gene’s r526 and add this feature to it.

Is this feature just to restart HG, or is it to restart an internal program? I currently can’t seem to get “Ping Me at Home Extended” to keep running. If I can auto restart it I could use it.

This feature only restarts an internal program in case it crashes.
I have made a compilation of actual r526 and my changes, you can download .deb or .zip from GitHub: https://github.com/Bounz/HomeGenie/releases/tag/v1.1-beta.526.bounz

Very cool and just what i need.

Now I have an idea for you. What I really want is a way to identify smart phones of people who frequent my home. Ip numbers really don’t do that as DHCP might assign different ip numbers for the same device. What we really need is a program that will identify the MAC number of the interface as this is unique and consistent. Something that uses arp-scan looks promising. I think you have the programming skills to do this as I do not. Being able to know when people are in the local network AKA “at home” would be very useful. You could then have HG greet people and adjust the reaction of HG based on who is there. This would be a feature I haven’t seem in other HA programs. Maybe making HG more desirable!

Clay

I installed your version above this morning and the web interface isn’t found I tried ports 80 88 8080. ps -aux | less lists hg as running. Is your version compiled with a different port number??

edit- I found it at 8081 by using this command netstat -tulpn | grep LISTEN I don’t know why its 8081 port 80 and 8080 are not used on my Rpi

Hi, Claton.
It’s very interesting. I didn’t change the default port, so it should be 8080 if it’s not occupied by another program. In that case, HG tries to assign itself to the next port (8081) and so on. So try to connect on 8081 or 8082.
Also if start HG using startup.sh (not service), then it outputs the used port in the console.
And of course, you can use command sudo lsof -i to find which ports are in use.

Upd: glad to hear that you have found used port. Try to use lsof command to check who uses 8080.

here is the output doesn’t look like 80 or 8080 is used.
Please look at the last few lines. They seem to contain ip’s in china and vietman. What do you make of this???

pi@homegenie:~ $ sudo lsof -i
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
avahi-dae 355 avahi 12u IPv4 8169 0t0 UDP *:mdns
avahi-dae 355 avahi 13u IPv6 8170 0t0 UDP *:mdns
avahi-dae 355 avahi 14u IPv4 8171 0t0 UDP *:60322
avahi-dae 355 avahi 15u IPv6 8172 0t0 UDP *:53942
dhcpcd 597 root 8u IPv4 8702 0t0 UDP *:bootpc
sshd 598 root 3u IPv4 9069 0t0 TCP *:ssh (LISTEN)
sshd 598 root 4u IPv6 9076 0t0 TCP *:ssh (LISTEN)
ntpd 639 ntp 16u IPv4 9270 0t0 UDP *:ntp
ntpd 639 ntp 17u IPv6 9310 0t0 UDP *:ntp
ntpd 639 ntp 18u IPv4 9322 0t0 UDP localhost:ntp
ntpd 639 ntp 19u IPv4 9323 0t0 UDP 192.168.0.64:ntp
ntpd 639 ntp 20u IPv6 9324 0t0 UDP localhost:ntp
ntpd 639 ntp 21u IPv6 9325 0t0 UDP [fe80::50d:81b4:67d8:b33e]:ntp
master 771 root 12u IPv4 9795 0t0 TCP *:smtp (LISTEN)
sshd 969 root 3u IPv4 10316 0t0 TCP 192.168.0.64:ssh->192.168.0.4:59146 (ESTABLISHED)
sshd 1001 pi 3u IPv4 10316 0t0 TCP 192.168.0.64:ssh->192.168.0.4:59146 (ESTABLISHED)
sshd 1228 root 3u IPv4 11556 0t0 TCP 192.168.0.64:ssh->192.168.0.4:59162 (ESTABLISHED)
sshd 1246 pi 3u IPv4 11556 0t0 TCP 192.168.0.64:ssh->192.168.0.4:59162 (ESTABLISHED)
mono 1320 root 3u IPv4 12163 0t0 TCP *:tproxy (LISTEN)
mono 1320 root 6u IPv4 32189 0t0 UDP *:1900
mono 1320 root 7u IPv4 32190 0t0 UDP 192.168.0.64:48404
mono 1320 root 8u IPv6 32191 0t0 UDP *:1900
mono 1320 root 9u IPv6 32192 0t0 UDP [fe80::50d:81b4:67d8:b33e]:41260
mono 1320 root 10u IPv4 32193 0t0 UDP *:1900
mono 1320 root 11u IPv4 32194 0t0 UDP localhost:34887
mono 1320 root 12u IPv4 32195 0t0 UDP 192.168.0.64:41590
mono 1320 root 13u IPv6 32196 0t0 UDP [fe80::50d:81b4:67d8:b33e]:48186
mono 1320 root 14u IPv4 32197 0t0 UDP localhost:51567
mono 1320 root 16u IPv4 33241 0t0 TCP 192.168.0.64:tproxy->192.168.0.4:59752 (ESTABLISHED)
mono 1320 root 18u IPv4 12235 0t0 UDP *:1900
mono 1320 root 20u IPv4 12209 0t0 UDP *:1900
mono 1320 root 21u IPv4 12210 0t0 UDP 192.168.0.64:37986
mono 1320 root 22u IPv6 12211 0t0 UDP *:1900
mono 1320 root 23u IPv6 12212 0t0 UDP [fe80::50d:81b4:67d8:b33e]:33112
mono 1320 root 24u IPv4 12213 0t0 UDP *:1900
mono 1320 root 25u IPv4 12214 0t0 UDP localhost:56741
mono 1320 root 26u IPv4 12216 0t0 TCP 192.168.0.64:33462 (LISTEN)
mono 1320 root 27u IPv6 12217 0t0 TCP [fe80::50d:81b4:67d8:b33e]:37341 (LISTEN)
mono 1320 root 28u IPv4 12218 0t0 TCP localhost:38571 (LISTEN)
mono 1320 root 29u IPv4 12221 0t0 TCP 192.168.0.64:38513 (LISTEN)
mono 1320 root 30u IPv6 12222 0t0 TCP [fe80::50d:81b4:67d8:b33e]:39000 (LISTEN)
mono 1320 root 31u IPv4 12223 0t0 TCP localhost:41395 (LISTEN)
mono 1320 root 32u IPv4 12225 0t0 UDP *:1900
mono 1320 root 33u IPv4 12226 0t0 UDP 192.168.0.64:48618
mono 1320 root 34u IPv6 12227 0t0 UDP *:1900
mono 1320 root 35u IPv6 12228 0t0 UDP [fe80::50d:81b4:67d8:b33e]:39583
mono 1320 root 36u IPv4 12230 0t0 UDP *:1900
mono 1320 root 37u IPv4 12231 0t0 UDP 192.168.0.64:49009
mono 1320 root 38u IPv6 12232 0t0 UDP *:1900
mono 1320 root 39u IPv6 12233 0t0 UDP [fe80::50d:81b4:67d8:b33e]:54656
mono 1320 root 40u IPv4 12234 0t0 UDP *:1900
mono 1320 root 41u IPv4 12236 0t0 UDP localhost:55100
mono 1320 root 42u IPv4 12237 0t0 UDP localhost:34533
mono 1320 root 45u IPv4 32203 0t0 UDP *:1900
mono 1320 root 46u IPv4 12248 0t0 UDP *:1900
mono 1320 root 47u IPv4 12249 0t0 UDP 192.168.0.64:36033
mono 1320 root 48u IPv6 12250 0t0 UDP *:1900
mono 1320 root 49u IPv6 12251 0t0 UDP [fe80::50d:81b4:67d8:b33e]:58181
mono 1320 root 50u IPv4 12252 0t0 UDP *:1900
mono 1320 root 51u IPv4 12253 0t0 UDP localhost:41801
mono 1320 root 52u IPv4 12255 0t0 UDP *:1900
mono 1320 root 53u IPv4 12256 0t0 UDP 192.168.0.64:47547
mono 1320 root 54u IPv6 12257 0t0 UDP *:1900
mono 1320 root 55u IPv6 12258 0t0 UDP [fe80::50d:81b4:67d8:b33e]:43016
mono 1320 root 56u IPv4 12259 0t0 UDP *:1900
mono 1320 root 57u IPv4 12260 0t0 UDP localhost:36491
mono 1320 root 58u IPv4 32204 0t0 UDP 192.168.0.64:43620
mono 1320 root 59u IPv6 32205 0t0 UDP *:1900
mono 1320 root 60u IPv6 32206 0t0 UDP [fe80::50d:81b4:67d8:b33e]:39916
mono 1320 root 61u IPv4 32207 0t0 UDP *:1900
mono 1320 root 62u IPv4 32208 0t0 UDP localhost:36727
mono 1320 root 64u IPv4 32211 0t0 UDP *:1900
mono 1320 root 65u IPv4 32212 0t0 UDP 192.168.0.64:57115
mono 1320 root 66u IPv6 32213 0t0 UDP *:1900
mono 1320 root 67u IPv6 32214 0t0 UDP [fe80::50d:81b4:67d8:b33e]:41933
mono 1320 root 68u IPv4 32215 0t0 UDP *:1900
mono 1320 root 69u IPv4 32216 0t0 UDP localhost:33687
mono 1320 root 70u IPv4 32218 0t0 UDP *:1900
mono 1320 root 71u IPv4 32219 0t0 UDP 192.168.0.64:48936
mono 1320 root 72u IPv6 32220 0t0 UDP *:1900
mono 1320 root 73u IPv6 32221 0t0 UDP [fe80::50d:81b4:67d8:b33e]:45952
mono 1320 root 74u IPv4 32222 0t0 UDP *:1900
mono 1320 root 77u IPv4 32226 0t0 UDP localhost:52489
mono 1320 root 78u IPv4 32235 0t0 UDP *:1900
mono 1320 root 80u IPv4 32237 0t0 UDP 192.168.0.64:38191
mono 1320 root 81u IPv6 32239 0t0 UDP *:1900
mono 1320 root 82u IPv6 32240 0t0 UDP [fe80::50d:81b4:67d8:b33e]:44429
mono 1320 root 83u IPv4 32241 0t0 UDP *:1900
mono 1320 root 84u IPv4 32242 0t0 UDP localhost:34717
mono 1320 root 85u IPv4 32243 0t0 UDP *:1900
mono 1320 root 86u IPv4 32244 0t0 UDP 192.168.0.64:34910
mono 1320 root 87u IPv6 32245 0t0 UDP *:1900
mono 1320 root 88u IPv6 32246 0t0 UDP [fe80::50d:81b4:67d8:b33e]:51343
mono 1320 root 89u IPv4 32247 0t0 UDP *:1900
mono 1320 root 90u IPv4 32248 0t0 UDP localhost:36691
mono 1320 root 91u IPv4 32253 0t0 UDP *:1900
mono 1320 root 95u IPv4 32254 0t0 UDP 192.168.0.64:44117
mono 1320 root 96u IPv6 32255 0t0 UDP *:1900
mono 1320 root 97u IPv6 32256 0t0 UDP [fe80::50d:81b4:67d8:b33e]:53413
mono 1320 root 98u IPv4 32257 0t0 UDP *:1900
mono 1320 root 99u IPv4 32258 0t0 UDP localhost:59447
sshd 8466 root 3u IPv4 40258 0t0 TCP 192.168.0.64:ssh->59.63.166.102:37725 (ESTABLISHED)
sshd 8466 root 4u IPv4 40324 0t0 UDP 192.168.0.64:34828->dslmodem.applylabels.com:domain
sshd 8467 sshd 3u IPv4 40258 0t0 TCP 192.168.0.64:ssh->59.63.166.102:37725 (ESTABLISHED)
sshd 8472 root 3u IPv4 40298 0t0 TCP 192.168.0.64:ssh->103.79.143.25:55661 (ESTABLISHED)
sshd 8472 root 4u IPv4 40323 0t0 UDP 192.168.0.64:47048->dslmodem.applylabels.com:domain
sshd 8473 sshd 3u IPv4 40298 0t0 TCP 192.168.0.64:ssh->103.79.143.25:55661 (ESTABLISHED)

It looks weird. Especially in conjunction with domain name dslmodem.applylabels.com, which I can’t access and applylabes.com stands for a company in Minnesota. It also looks disturbingly because it is related to ssh service. You can try to figure out which programs are running with those pids.

As about HG - I was wrong in the use of lsof command (I’m not unix guru). I used it to figure out which program uses the specific port, but the syntax is a little bit different: lsof -i :8080. So for the purposes of listing used ports your netstat -tulpn command is great.

applylabels.com is my business name.

ip 59.63.166.102 is china
ip 103.79.143.25 is vietman
they appear to be connected to my rpi I think?

I’m not a computer guru at all! LOL

Yes, looks like that. But unfortunately I don’t know how to read output of lsof command well.

I found out they are hackers looking for ssh connections. They didn’t get past my password and couldn’t connect. I have ssh open to the internet so I can reboot the rpi when hg crashes and i’m not home. I may need to find a more secure way to do this.

BTW I really like the auto restart. Works great! Now I can keep “ping me at home extended” running. I’m already finding how unsuitable this is for presence detection. Smart phones often turn the WiFi off when not in use. This requires setting adjustments to keep wifi on all the time.

Thanks for the help!

Clay

Glad to hear that your server is in safety! As one of the possible ways to level up your security, you may configure your ssh service to listen on a non-default port.

I’m happy that auto-restart feature is useful for you. I believe that at some point in time Gene will merge it to the main branch and it will become available to all users.

P.S. If you don’t mind I’m going to move your post about presence feature into a separate topic.

I am trying to code this at the moment - so you have a people class and a devices class…

people contains devices, you scan for mac’s and then tell hg who the device was - which is ok for people you know, you could make it prompt you when visitors arrive etc…

for mac addresses I scan my DDWRT routers mac address table and then push to HG to trigger a virtual module currently - but again I want to add discovery and occupancy which I am currently looking at…