Restarting DomotiGa automatically

Forum about Domotiga Open Source Home Automation for Linux.

Moderator: RDNZL

Andy_Burn
Starting Member
Starting Member
Posts: 43
Joined: Sun Nov 28, 2010 10:47 pm

Restarting DomotiGa automatically

Post by Andy_Burn »

I've had some issues during testing my X10 lights. After switching lights on/off several times, checking for function, the program crashes without warning, and does not restart. I dont know why, maybe the buffer fills up? There are no entries in the logs.

So.
I wrote a script to restart DomotiGa. It runs when the machine boots and auto logs into Gnome. You can enter it in Preferences>Startup Applications.
#file /home/domotiga/Domotiga/domorestart.sh

Code: Select all

#!/bin/bash
OUT=~/DomotiGa/logs/restart.log
sleep 2m; gbr2 /home/domotiga/DomotiGa/DomotiGa.gambas &
sleep 1m
while true; do
COUNT=`ps -ef | grep -v grep | grep -c gbr2`
if [ $COUNT == 0 ]; then
gbr2 /home/domotiga/DomotiGa/DomotiGa.gambas &
echo "Restarted $(date)" >> $OUT
fi
sleep 1m
done
This can be modified for DomotiGaServer too (or muliple items). If you use it, remember to chmod +x the file!
Hope this helps someone (dont blame me if you blow something up!) :)

Andy
Andy_Burn
Starting Member
Starting Member
Posts: 43
Joined: Sun Nov 28, 2010 10:47 pm

Re: Restarting DomotiGa automatically

Post by Andy_Burn »

On a related note,
I have also noticed that DomotiGa can crash unexpectedly. Has anyone else seen this??
I will start and log the errors I get.
The problem is that when there is a crash, there is often a dialog box which pops ups requiring a response. i.e. no clean exit. When this happens for the GUI server, it will not restart with this script. Perhaps it can be made to dump to a file and exit? I'll have a closer look. Either way, I think I'll look at using DomotiGaServer instead.
Cheers,
Andy
User avatar
RDNZL
Forum Moderator
Forum Moderator
Posts: 1008
Joined: Sun Sep 24, 2006 1:45 pm
Location: Dordrecht, The Netherlands
Contact:

Re: Restarting DomotiGa automatically

Post by RDNZL »

Can you make a screenshot if you get this again?
It's very stable here, but it could be just a small error which isn't catched properly
Regards, Ron.
Andy_Burn
Starting Member
Starting Member
Posts: 43
Joined: Sun Nov 28, 2010 10:47 pm

Re: Restarting DomotiGa automatically

Post by Andy_Burn »

Here is one.....
I've turned off my server stats for now.
Thanks,
Andy
Attachments
Random crash RRD related...
Random crash RRD related...
Screenshot.png (233.57 KiB) Viewed 13764 times
User avatar
RDNZL
Forum Moderator
Forum Moderator
Posts: 1008
Joined: Sun Sep 24, 2006 1:45 pm
Location: Dordrecht, The Netherlands
Contact:

Re: Restarting DomotiGa automatically

Post by RDNZL »

Which Linux distro do you run?
How many memory does your machine have?
This is a system error, no resources left.

On Ubuntu Maverick I have some times a problem with RRD too, but then "too many open files"

Now all RRD calls are done with SHELL, which mean a complete shell environment is started for each command running.
I want to change it to use EXEC instead which should be a bit faster en lighter...
Regards, Ron.
Andy_Burn
Starting Member
Starting Member
Posts: 43
Joined: Sun Nov 28, 2010 10:47 pm

Re: Restarting DomotiGa automatically

Post by Andy_Burn »

The machine has 2Gig memory, running Linux Mint 10, fullly updated. Strange because I can do other things, the machine is not frozen.
I am logging Currentcost with it, which generates a call every few seconds, by quick graph - could it be this?. Also plotting outside temp/humidity and inside temp/humidity.
Thanks, Andy
j.hoekstra
Member
Member
Posts: 255
Joined: Thu Jun 25, 2009 2:09 pm
Location: Enschede, The Netherlands

Re: Restarting DomotiGa automatically

Post by j.hoekstra »

Got the same thing every now and again, now it only produces this error or freezes every couple of days with rrd switched on. To me it seems gambas is eating memory as before I start gambas I got around 1200M free of 2 GB and up until error this has dropped to around 200 MB. Stopping Gambas drops this again.
I'll see if a later svn-checkout of gambas helps.
Andy_Burn
Starting Member
Starting Member
Posts: 43
Joined: Sun Nov 28, 2010 10:47 pm

Re: Restarting DomotiGa automatically

Post by Andy_Burn »

Heres another crash :( XML this time. mmmm.

Andy
Attachments
Screenshot-1.png
Screenshot-1.png (163.36 KiB) Viewed 13744 times
Andy_Burn
Starting Member
Starting Member
Posts: 43
Joined: Sun Nov 28, 2010 10:47 pm

Re: Restarting DomotiGa automatically

Post by Andy_Burn »

For a trial, Ive gone back to 0.1.192 server code, patched it for my currentcost envi unit and modified the restart script for DomotigaServer. I'm using Client 0.1.193 (I know, its probably bad!) for administration on another machine.
Fingers crossed. I like to mess around :) I just want to see if it crashes...

Andy
User avatar
RDNZL
Forum Moderator
Forum Moderator
Posts: 1008
Joined: Sun Sep 24, 2006 1:45 pm
Location: Dordrecht, The Netherlands
Contact:

Re: Restarting DomotiGa automatically

Post by RDNZL »

Andy_Burn wrote:Heres another crash :( XML this time. mmmm.

Andy
This code is called by the TVGuide's code, there was something wrong with fetching the xml data from microsoft's site.
But the error display call had too many parameters, a bug that is fixed now in latest revision.
Thanks for reporting!
Regards, Ron.
User avatar
RDNZL
Forum Moderator
Forum Moderator
Posts: 1008
Joined: Sun Sep 24, 2006 1:45 pm
Location: Dordrecht, The Netherlands
Contact:

Re: Restarting DomotiGa automatically

Post by RDNZL »

Andy_Burn wrote:For a trial, Ive gone back to 0.1.192 server code, patched it for my currentcost envi unit and modified the restart script for DomotigaServer. I'm using Client 0.1.193 (I know, its probably bad!) for administration on another machine.
Fingers crossed. I like to mess around :) I just want to see if it crashes...

Andy
The later revisions use EXEC instead of SHELL for RRDtool code, which should work better than the old one, can you try it?
I also fixed the XMLparse error, so no need to go back because of that anymore.

And if you are willing to send your envi code I will see if I can intergrate it, so you don't have to patch it everytime new versions come out.
New version means different database layout, so if you mix them you are going to get errors/problems for sure :roll:
Regards, Ron.
Andy_Burn
Starting Member
Starting Member
Posts: 43
Joined: Sun Nov 28, 2010 10:47 pm

Re: Restarting DomotiGa automatically

Post by Andy_Burn »

I'll be off work next week. I'll fix up the code and send it to you.
Meanwhile I'll give the new version a shot :)
Thanks,
Andy
Andy_Burn
Starting Member
Starting Member
Posts: 43
Joined: Sun Nov 28, 2010 10:47 pm

Re: Restarting DomotiGa automatically

Post by Andy_Burn »

I thought my system was running fine. No problems really, since the new release 0.1.194
Then, my wife calls me at work to say the house is over 28C....
It looks like RRD doesnt like recording a lot of data... The gui crashed when the heating was on, causing a run away.
Im going to turn off RRDTool for now. Maybe, I'll run the server with a restart script. At least theres no gui to prevent it restarting if it crashes.
Andy
Attachments
RRD error too many open files.
RRD error too many open files.
Screenshot.png (239.05 KiB) Viewed 13695 times
User avatar
RDNZL
Forum Moderator
Forum Moderator
Posts: 1008
Joined: Sun Sep 24, 2006 1:45 pm
Location: Dordrecht, The Netherlands
Contact:

Re: Restarting DomotiGa automatically

Post by RDNZL »

Can you increase max number of open files, to see if this helps?

Code: Select all

$ sudo su -
# ulimit -a
core file size          (blocks, -c) 0
data seg size           (kbytes, -d) unlimited
scheduling priority             (-e) 20
file size               (blocks, -f) unlimited
pending signals                 (-i) 16382
max locked memory       (kbytes, -l) 64
max memory size         (kbytes, -m) unlimited
open files                      (-n) 1024
pipe size            (512 bytes, -p) 8
POSIX message queues     (bytes, -q) 819200
real-time priority              (-r) 0
stack size              (kbytes, -s) 8192
cpu time               (seconds, -t) unlimited
max user processes              (-u) unlimited
virtual memory          (kbytes, -v) unlimited
file locks                      (-x) unlimited

$ sudo su -
# ulimit -n 4096

# ulimit -a
core file size          (blocks, -c) 0
data seg size           (kbytes, -d) unlimited
scheduling priority             (-e) 20
file size               (blocks, -f) unlimited
pending signals                 (-i) 16382
max locked memory       (kbytes, -l) 64
max memory size         (kbytes, -m) unlimited
open files                      (-n) 4096
pipe size            (512 bytes, -p) 8
POSIX message queues     (bytes, -q) 819200
real-time priority              (-r) 0
stack size              (kbytes, -s) 8192
cpu time               (seconds, -t) unlimited
max user processes              (-u) unlimited
virtual memory          (kbytes, -v) unlimited
file locks                      (-x) unlimited

Regards, Ron.
User avatar
RDNZL
Forum Moderator
Forum Moderator
Posts: 1008
Joined: Sun Sep 24, 2006 1:45 pm
Location: Dordrecht, The Netherlands
Contact:

Re: Restarting DomotiGa automatically

Post by RDNZL »

To check current # of open files in use.
Find your DomotiGa instance first, and then run lsof

Code: Select all

$ ps -aux|grep gb
ron      18250  0.1  1.5  32108 16116 ?        S    09:05   0:05 /usr/local/bin/gbx2 -g -f /home/ron/domotiga/DomotiGa --

$ lsof |grep gbx2|wc -l
383

If you have the error on screen, do you many rrd processes running?
$ ps -aux|grep rrd

Regards, Ron.
Post Reply

Return to “DomotiGa Forum”