xPL Perl - Startup / Shutdown service

Forum regarding Linux Software and Home Automation Domotica.

xPL Perl - Startup / Shutdown service

Postby Jfn » Sat Mar 15, 2008 7:30 pm

As I am expecting my 1-wire stuff to arrive within the next few weeks I started looking into xPL-Perl. Thanks to the wiki by Erik (user snelvuur here on the forum) installation was easy.

As I do not have any devices connected yet, I started with some basic things like adding/stopping/starting services. What I noticed when stopping a service ('sv stop xpl-rfxcom' for example), is that it does not stop (See code below). Is this normal behaviour?

Is it by design that a service stop means that the service itself stays in memory, but that it is only put to sleep?

Code: Select all
debian:/# ps -ef | grep xpl
root      2826  2748  0 18:10 ?        00:00:00 runsv xpl-rrd
root      2827  2748  0 18:10 ?        00:00:00 runsv xpl-hub
root      2830  2748  0 18:10 ?        00:00:00 runsv xpl-dawndusk
root      3010  2748  0 18:16 ?        00:00:00 runsv xpl-rfxcom
root      4095  2596  0 18:23 pts/0    00:00:00 grep xpl
debian:/# strace sv down xpl-rfxcom
execve("/usr/bin/sv", ["sv", "down", "xpl-rfxcom"], [/* 17 vars */]) = 0
gettimeofday({1205601894, 435445}, NULL) = 0
open(".", O_RDONLY|O_NONBLOCK)          = 3
chdir("/var/service/")                  = 0
chdir("xpl-rfxcom")                     = 0
open("supervise/ok", O_WRONLY|O_NONBLOCK) = 4
close(4)                                = 0
open("supervise/status", O_RDONLY|O_NONBLOCK) = 4
read(4, "@\0\0\0G\334\6o+\361\220\254\216\20\0\0\0u\0\1", 20) = 20
close(4)                                = 0
open("supervise/control", O_WRONLY|O_NONBLOCK) = 4
write(4, "d", 1)                        = 1
close(4)                                = 0
fchdir(3)                               = 0
_exit(0)                                = ?
Process 4240 detached
debian:/# ps -ef | grep xpl
root      2826  2748  0 18:10 ?        00:00:00 runsv xpl-rrd
root      2827  2748  0 18:10 ?        00:00:00 runsv xpl-hub
root      2830  2748  0 18:10 ?        00:00:00 runsv xpl-dawndusk
root      3010  2748  0 18:16 ?        00:00:00 runsv xpl-rfxcom
root      4247  2596  0 18:25 pts/0    00:00:00 grep xpl
debian:/#



Als het niet kapot is, niet repareren!
Jfn
Member
Member
 
Posts: 332
Joined: February 2008
Location: Netherlands

xPL Perl - Startup / Shutdown service

Postby Snelvuur » Sat Mar 15, 2008 7:34 pm

the runsv is not the actual program that is still running. there is also a service which does the logfiles too, so this is normal. you can check with "sv status /var/service/*" what the current status is.

debian:~# sv status /var/service/*
run: /var/service/redir: (pid 6855) 6551832s; run: log: (pid 6854) 6551832s
run: /var/service/smsdaemon: (pid 30278) 1023276s; run: log: (pid 6286) 6552679s
run: /var/service/xpl-ctx35: (pid 31053) 1470829s; run: log: (pid 3165) 6554107s
run: /var/service/xpl-dawndusk: (pid 3162) 6554107s; run: log: (pid 3160) 6554107s
run: /var/service/xpl-hddtemp: (pid 3164) 6554107s; run: log: (pid 3163) 6554107s
run: /var/service/xpl-hub: (pid 3168) 6554107s; run: log: (pid 3167) 6554107s
run: /var/service/xpl-rfxcom: (pid 3158) 6554107s; run: log: (pid 3157) 6554107s
run: /var/service/xpl-rrd: (pid 3161) 6554107s; run: log: (pid 3159) 6554107s
run: /var/service/xpl-sms-send: (pid 29027) 1025183s; run: log: (pid 31539) 1470546s
run: /var/service/xpl-sql-logger: (pid 6373) 6552546s; run: log: (pid 6826) 6552179s

So it is normal.. and you can always use xpl-perl without zenah (the gui) if needed. Dont know how good you are at perl but help is always welcome.

// Erik (binkey.nl)
User avatar
Snelvuur
Forum Moderator
Forum Moderator
 
Posts: 3156
Joined: April 2007
Location: Netherlands

xPL Perl - Startup / Shutdown service

Postby Jfn » Sat Mar 15, 2008 7:49 pm

Thanks

I just started programming in perl, so my skills are growing every day. I am more experienced in programming in shell on AIX and HP-UX, as these are the systems I deal with on a daily basis and shell programming gets me where I want to go.

Btw, I edited your wiki on xpl-perl. Installing xpl-perl on Debian is actually done by running 'apt-get install <i>lib</i>xpl-perl'. Without the 'lib' it would not work.

I tried installing Zenah also, but that bugged out on me with several errors. Will look into that further eventually.

Als het niet kapot is, niet repareren!
Jfn
Member
Member
 
Posts: 332
Joined: February 2008
Location: Netherlands

xPL Perl - Startup / Shutdown service

Postby Snelvuur » Sat Mar 15, 2008 8:16 pm

Well the wiki is where its for, if you find additions or changes that might be usefull put it on the wiki, since its mostly a one men job. I put in now and then a good entry which is on the forum to fill it more.

// Erik (binkey.nl)
User avatar
Snelvuur
Forum Moderator
Forum Moderator
 
Posts: 3156
Joined: April 2007
Location: Netherlands

xPL Perl - Startup / Shutdown service

Postby Jfn » Sat Mar 15, 2008 8:50 pm

Took another look at some of the xpl scripts in /usr/bin. It seems fairly easy to program your own scripts.

I am thinking of letting the xpl-rfxcom/xpl-digitemp scripts do the datacollection and write my own xpl-style script to fill an MySQL database with the data I receive, based on conditions I set in the script. After this it is up to PHP code to dynamically generate the graphics.

The script xpl-sql-logger merely does what I want, but it logs an entry for every event occurring which in some cases seems overdone (For example: The Visonic doorsensors update their status every 15 minutes) and I do not need an extra entry added to the database every 15 minutes telling me a door is closed or is still open).


Als het niet kapot is, niet repareren!
Jfn
Member
Member
 
Posts: 332
Joined: February 2008
Location: Netherlands

xPL Perl - Startup / Shutdown service

Postby Snelvuur » Sat Mar 15, 2008 8:58 pm

i know beanz, the builder of all the xpl-perl things wants to build further on perl for zenah as a gui, which you can also say what you want to store in the sql via "rulesets" but for me its still a bit complex but eventually i will get it to work i just need to put some real time in it. Still have my backup homeseer copy though :)

If you want to make something for php go ahead, perhaps you can build something which works with xpl-perl. Like i said xpl-perl can be used as stand alone, so if you want to build an interface for it you can do that too and only improve the open source here.

// Erik (binkey.nl)
User avatar
Snelvuur
Forum Moderator
Forum Moderator
 
Posts: 3156
Joined: April 2007
Location: Netherlands

xPL Perl - Startup / Shutdown service

Postby beanz » Sun Mar 16, 2008 10:55 am

<blockquote id="quote"><font size="1" face="Verdana, Arial, Helvetica" id="quote">quote:<hr height="1" noshade id="quote"><i>Originally posted by Jfn</i>
<br />Thanks

I just started programming in perl, so my skills are growing every day.
<hr height="1" noshade id="quote"></font id="quote"></blockquote id="quote">I started programming in perl a long time ago and my skills are still growing most days too. Perl seems to have a never-ending learning curve.

<blockquote id="quote"><font size="1" face="Verdana, Arial, Helvetica" id="quote">quote:<hr height="1" noshade id="quote">I tried installing Zenah also, but that bugged out on me with several errors. Will look into that further eventually.
<hr height="1" noshade id="quote"></font id="quote"></blockquote id="quote">Feel free to post some info and Erik and I will try to help.
beanz
Starting Member
Starting Member
 
Posts: 20
Joined: June 2007
Location: United Kingdom

xPL Perl - Startup / Shutdown service

Postby beanz » Sun Mar 16, 2008 11:12 am

<blockquote id="quote"><font size="1" face="Verdana, Arial, Helvetica" id="quote">quote:<hr height="1" noshade id="quote"><i>Originally posted by Jfn</i>
<br />Took another look at some of the xpl scripts in /usr/bin. It seems fairly easy to program your own scripts.
<hr height="1" noshade id="quote"></font id="quote"></blockquote id="quote">If you need any help, feel free to post questions here (though I read this forum irregularly) or to the xpl-perl-dev mailing list.

<blockquote id="quote"><font size="1" face="Verdana, Arial, Helvetica" id="quote">quote:<hr height="1" noshade id="quote">I am thinking of letting the xpl-rfxcom/xpl-digitemp scripts do the datacollection and write my own xpl-style script to fill an MySQL database with the data I receive, based on conditions I set in the script. After this it is up to PHP code to dynamically generate the graphics.

The script xpl-sql-logger merely does what I want, but it logs an entry for every event occurring which in some cases seems overdone (For example: The Visonic doorsensors update their status every 15 minutes) and I do not need an extra entry added to the database every 15 minutes telling me a door is closed or is still open).
<hr height="1" noshade id="quote"></font id="quote"></blockquote id="quote">I probably should document which scripts I am actually using and hence which I recommend.

For instance, I don't use xpl-digitemp, I use xpl-owfs. The main reason is that xpl-owfs also supports control.basic for triggering one-wire relays which might not affect you but it is certainly something to keep in mind if you might use it in the future. I also recall the configuration for xpl-digitemp is a pain to maintain but I've not really looked at it in a while.

I also do not use the xpl-sql-logger. It was really just a toy example. As you say, logging every single xpl message is just overkill. I use xpl-rrd to log to rrd files to keep long term data - like temperatures, humidity, etc - and I use zenah to track the current state in an SQL database. That said, I'm adding support for rrd databases to zenah and will stop using (and probably recommending xpl-rrd soon). (I don't use the zenah history table and I'll probably remove it before any release.)

Zenah is really three things:

<ul>
<li> a rules engine which triggers actions based on incoming xpl messages, timers, etc.
</li>
<li> a web interface for updating the database for the rules engine
</li>
<li> a web interface with an *example* user interface
</li>
</ul>

If you are considering doing your own thing, you might want to consider using either just the rules engine or maybe just the rules engine and the web interface to the database.

Whatever you decide, any feedback about xpl-perl and/or zenah is always appreciated.
beanz
Starting Member
Starting Member
 
Posts: 20
Joined: June 2007
Location: United Kingdom


Return to Linux Forum

Who is online

Users browsing this forum: No registered users and 1 guest