Cannot get CRON working.

5 replies [Last post]
kema01
Offline
MAIDSTONE, United Kingdom
Joined: 8 Jul 2013

Cannot get CRON working.

am a novice to the hah so please be gentle, I may have missed something obviouse to the expert eye.

I have followed the instructions in the cron wiki over and over, but still cannot get it to issue a command. The example I am using is as follows:- 

05 14 * * * aliasmsg "rf.2 -s on".

I can get rf 2 to turn on from the command prompt with   aliasmsg "rf.2 -s on". 

I have enable cron in the services.

Do I have to use vi ? Or can I cut and paste directly into the crontab root file. 

When I crontab –l, it all looks ok.

Any help would be much appreciated.


By the way:-

If I try # bscmsg, in the command prompt, i get the following error. I think this may be the same problem as issue 33.

/usr/bin/lua: /usr/share/lua/5.1/pl/lapp.lua:139: attempt to index upvalue 'types' (a nil value)

stack traceback:

        /usr/share/lua/5.1/pl/lapp.lua:139: in function 'add_type'

        /usr/bin/bscmsg:9: in main chunk

        [C]: ?

derek
Offline
Glasgow, United Kingdom
Joined: 26 Oct 2009
Check the daemon

Well, this is kinda in Brett's space but he is moving house (again) at the moment.

Have you checked that the cron daemon is actually running? It should show up as 'crond' if you run a 'ps' from the command line. 

I'd recommend using vi directly. Using cut/paste (especially in Windows) can leave weird characters in files - this can upset things.

It's probably more longwinded but I've tended to use the xap-GoogleCal piece to perform 'timed events'.

Cheers,
Derek.

allanayr
Offline
Ayr, United Kingdom
Joined: 25 Sep 2011
I'm not sure about

I'm not sure about the syntax of your aliasmsg. I think it should be aliasmsg "rf 2 on" (no period between rf and 2 and no -s)

(I'm sure you have checked but) you should also ensure that you have the alias interpreter applet running.

The command crontab -e will open the root cron file in vi for you to edit directly.

Hope this helps.

 

derek
Offline
Glasgow, United Kingdom
Joined: 26 Oct 2009
Good for me

It's been quite a while since I gave the cron thing a test, so I went back & tried it. All seems fine. As Allan says, the aliasmsg syntax that you quote is not correct - however, I'm sure that if you use the same aliasmsg command that works for you at the command line, it will be fine.

One other thought. Have you checked the datetime on your HAH box?

Here is the output from mine - I'm using NTP from 0.pool.ntp.org

# date

Sun Oct 20 16:13:10 BST 2013

and my /etc/crontabs/root has

# cat root
15 16 * * * aliasmsg "rf 1 off"

... and with the plugboard and crond processes running, my RF1 (Lidl RF switch) did indeed turn my desklight off at 16:15:00

I'm sure that if you presevere, it will come good.

Cheers,
Derek.
kema01
Offline
MAIDSTONE, United Kingdom
Joined: 8 Jul 2013
Sorted

Derek / Alan

Apologise for not getting back to you sooner.

I have had a problem with Googlecal, which has taken me some time to resolve, it turned out to be the NTP, which had to be set manually. After a firmware upgrade.

Many thanks for your help regarding my cron problem, which I have now resolved with your assistance, it was down to not using vi editor (extra chars) and the syntax I was using.  Yes it did work at the command prompt. This was caused by my haste to get cron working using the least amount of effort “blast cut and paste”. This has been a good lesson learned by me.

 

Many thanks again

 

kev

kema01
Offline
MAIDSTONE, United Kingdom
Joined: 8 Jul 2013
Going round in TZ circles.

Going round in TZ circles.

I think I have got to the bottom of why it took me an age to get cron working. In fact it was working all the time but was an hour out.

If you have no TZ file you see UTC on the WEB I/F (time incorrect by -1 hour) and Googlecal is in sync, but cron is 1 hour behind.

If you set TZ to GMT0BST-1  (TZ file created) then WEB I/F  time is correct and cron is in sync but Googlecal is one hour behind.

I have read numerous threads on this, but have not seen a definitive answer.

I have now set Googlecal itself to GMT -1 and all seem to work, except the current real time line is 1 hour behind, I can live with this.

I expect you all new about this, but it was good learning for me.

I expect I will have to adjust, after the clocks change this weekend !!!!!

Hardware Info