Cron guidance

5 replies [Last post]
garrydwilms
Offline
United Kingdom
Joined: 31 Mar 2011

Firstly, excellent work on the new scheduler Brett. Coupled with the google cal option this really does make this the perfect home heating controller(amongst a million other things!) As you know I found googlecal a bit twitchy and was always concerned about events not being carried out if my Internet drops out as it sometimes does. This fixes that but still allows scheduling on line if required.  That said I am struggling to set up the cron correctly.  Firstly I didn't have a /etc/cron folder so I created one.  I then put the bsc file (as described in another script) in there and chmod a+x'd it.  I altered my cron file to switch the rf.1 on but am not seeing any action. Xfx viewer also shows no xap from chron.  Am I right in thinking that I should be able to test the bsc script by simply putting the following command into the command line? /etc/cron/bsc -t dbzoo.livebox.controller:rf.1 -s on If so this just returns file not found.  I am on 296.4 firmware, any ideas Am I missing something obvious? Thanks As always Garry

brett
Offline
Providence, United States
Joined: 9 Jan 2010
Lots has change

Well I just pushed up 296.5 - as this is a beta things will change rapidily as you try to catch up and figure out what I'm up to.  What I say in old beta may not always apply to new ones.  It will be like this until I stabilize and release 297 :)

You will now need to enable cron via the ADMIN>Services TAB its not on automatically as of 296.5

Creating /etc/cron/bsc is not necessary as its now built in as /usr/bin/bscmsg.  Did you create /etc/cron/bsc btw?

A sample crontab might look like.  On at 7:00am and Off an 7:01am

0 7 * * * bscmsg -t dbzoo.livebox.controller:rf.1 -s on
1 7 * * * bscmsg -t dbzoo.livebox.controller:rf.1 -s off

ALSO as bscmsg is a built-in command you can run it from the command line to test that you have got the correct syntax before putting this same command line string into a crontab.

# bscmsg
bscmsg:missing required parameter: t

  Various flags and option types
    -t (string)   xAPBSC Target
    -s (onoff)    xAPBSC State
    -x            xAPBSC Text
    -l            xAPBSC Level
#

Brett

garrydwilms
Offline
United Kingdom
Joined: 31 Mar 2011
Sorted

thanks Brett, that clears things up.

RF control now working from command line using bscmsg. will play with scheduling from cron tomorrow.

cheers

garry

garrydwilms
Offline
United Kingdom
Joined: 31 Mar 2011
Excellent

This now works a treat, Thanks.

If I could be cheeky though, how easy would it be to alter the bscmsg to allow alias style commands. e.g. bscmsg -a rf 1 on

i think this may simplify the commands in cron and also from a selfish point of view, I use the alias function widely for thermostat setting and heating boosting, etc.

I have tried modding the file myself but the usr/bin dir is read only.

 

Thanks,

 

Garry.

brett
Offline
Providence, United States
Joined: 9 Jan 2010
crontab and custom scripts

Of course you can mod the script yourself just copy it out of /usr/bin to somewhere that has write access and get your crontab to run that script instead.  This is the whole idea of have a script based scheduling engine.  For example:

0 7 * * * /root/aliasmsg "rf 1 on"

I would not add a "-a" option to /usr/bin/bscmsg as what you want to send out is not actually a xAPBSC.cmd class so it's a bit of a bastardisation of this script.   You can however create your own scripts to do what every you like.

I can add an aliasmsg script that emits an ALIAS class message as a helper this might be useful.  It would work something like this.

aliasmsg "rf 1 on"

You would need quotes so that the contents is all processed as a single argument.

The entire aliasmsg script is reproduced here. I'll add this into my next beta drop.

#!/usr/bin/lua
lapp = require("pl.lapp")
local args = lapp
[[
Various flags and option types
<alias> (string) Alias command
]]
require("xap")

local cmd = string.format([[
xap-header
{
class=alias
}
command
{
text=%s
}]],args.alias)

xap.init("dbzoo.lua.aliasmsg","FF00DF00")
xap.sendShort(cmd)
garrydwilms
Offline
United Kingdom
Joined: 31 Mar 2011
Cheers - much appreciated

I did in fact try this (albeit with a much poorly wriited script!) however I struggled to get it to run.

I put it in the plugboard dir and chmod a+x'd it, but when I tried to send the command via command line I just kept getting 'file not found'??

I therefore wrongly assumed it was due to the location of the file. Not sure what I was doing wrong but anyhow you have kindly sorted it for me with the new 297 update.

 

Many thanks again for your time

 

Garry

Hardware Info