New user's registration have been closed due to high spamming and low trafic on this forum. Please contact forum admins directly if you need an account. Thanks !

Scheduled events not executing

"The best web gui for controlling your home using Telldus Tellstick"
Post Reply
gazza_d
Posts: 7
Joined: 20 Aug 2011, 07:10

Scheduled events not executing

Post by gazza_d »

I am struggling to get Scheduling working with HomeAutomation on a debian linux system.

I have both cron and atd installed and running.

I have at.allow, at.deny, cron.allow, and cron.deny in my /etc folder. root and www-data are in both allow files, and not in the deny files.

I can set a shedule and see it listed using atq.
in the apache2/error.log I get
warning: commands will be executed using /bin/sh
job 21 at Sat Aug 20 07:20:00 2011

and in syslog I get
Aug 20 07:20:01 myth-mbe atd[7598]: Authentication failure
Aug 20 07:20:01 myth-mbe cron[21360]: Error: bad command; while reading /etc/crontab
Aug 20 07:20:01 myth-mbe /usr/sbin/cron[21360]: (*system*) ERROR (Syntax error, this crontab file will be ignored)
Aug 20 07:20:01 myth-mbe /usr/sbin/cron[21360]: (www-data) RELOAD (crontabs/www-data)
DanielM
Posts: 637
Joined: 28 Mar 2008, 06:37
Location: Sweden

Re: Scheduled events not executing

Post by DanielM »

What happens if you first log in as www-data (su www-data) and then run the command "crontab -l"? Post the output here...

/Daniel
gazza_d
Posts: 7
Joined: 20 Aug 2011, 07:10

Re: Scheduled events not executing

Post by gazza_d »

Hi Daniel

as www-data, I initially get an authentication error, but it is ignored, and stuff seems to work.

Code: Select all

# su www-data
su: Authentication failure
(Ignored)
crontab -l returns:

Code: Select all

$ crontab -l
01 00 * * * /usr/bin//php /var/www/HomeAutomation/run.php command=updateschedules >/dev/null 2>&1
running the php command as www-data returns:

Code: Select all

$ /usr/bin/php /var/www/HomeAutomation/run.php command=activation id=3

Running schedule: Bedtime
Executing static activation
Activation has no criterias, execute.
3 devices toggled

Completed in 0.1634 seconds
$ 
DanielM
Posts: 637
Joined: 28 Mar 2008, 06:37
Location: Sweden

Re: Scheduled events not executing

Post by DanielM »

But wait a second... Is this even a Bubba you're using?

If not, are you sure www-data is the correct user? You should be able to see this by doing something like

Code: Select all

ps -eo euser,comm|grep apache
And by the way, what does /etc/crontab contain?

/Daniel
gazza_d
Posts: 7
Joined: 20 Aug 2011, 07:10

Re: Scheduled events not executing

Post by gazza_d »

actually, no It's a pogoplug with debian unstable on it. posted here as this seems like the only active forum for homeautomation. The Bubba looks interesting and similar though.

Did a lot more digging, and the AT jobs start, but then get stuck and do not complete. In the atspool directory, I get a one line file at he execution time containing the start of a mail.

The commands do work when ran at the command line as www-data (and that is the correct user), and if I schedule the command as root using AT, it does run.
DanielM
Posts: 637
Joined: 28 Mar 2008, 06:37
Location: Sweden

Re: Scheduled events not executing

Post by DanielM »

gazza_d wrote:actually, no It's a pogoplug with debian unstable on it. posted here as this seems like the only active forum for homeautomation. The Bubba looks interesting and similar though.

Did a lot more digging, and the AT jobs start, but then get stuck and do not complete. In the atspool directory, I get a one line file at he execution time containing the start of a mail.
Yep, the Bubba is a fantastic machine, I can recommend it :D

What does the file in the atspool directory contain more exactly?

/Daniel
gazza_d
Posts: 7
Joined: 20 Aug 2011, 07:10

Re: Scheduled events not executing

Post by gazza_d »

Each job file in atspool contains only the following details

Code: Select all

Subject: Output from your job       39
To: www-data
DanielM
Posts: 637
Joined: 28 Mar 2008, 06:37
Location: Sweden

Re: Scheduled events not executing

Post by DanielM »

gazza_d wrote:Each job file in atspool contains only the following details

Code: Select all

Subject: Output from your job       39
To: www-data
Hmmm... Not the file I was thinking it was. Do you have any nice files saying anything meaningful in /var/spool/cron/atjobs? In my system at creates a file there for every scheduled at job and it contains information about exactly what it's trying to run.

/Daniel
gazza_d
Posts: 7
Joined: 20 Aug 2011, 07:10

Re: Scheduled events not executing

Post by gazza_d »

yes, I do - here's one.

Edit: the forum software will not allow me to post the code, reporting it as too spammy for a new user. I will email the code to Tom and ask him to forward.

I have built a VM test server up, exactly the same, and that works. Rebuilt my physical box late last night thinking it must have been some weird clash, and it still does not work. only difference is the arch. the VM is i386 and the Pogoplug is armel, otherwise everything else is the same. But the upside is I now have a reference I can compare, which i will do today. It's turning out to be a very odd issue.
DanielM
Posts: 637
Joined: 28 Mar 2008, 06:37
Location: Sweden

Re: Scheduled events not executing

Post by DanielM »

Ok, got the code. Seems ok to me. Have you tried running any of the files in atjobs manually (logged in as www-data)? It's a shell script, might give some clue if that works or not.

Also note that B3 is also armel and it works perfectly, so it's not just the architecture that's the problem.

/Daniel
gazza_d
Posts: 7
Joined: 20 Aug 2011, 07:10

Re: Scheduled events not executing

Post by gazza_d »

Thanks

Yes i have tried running both just the command string and the full script from a command prompt su-ed as www-data and they execute without any problem.

going to step though and compare both the vm which work and the box which does not and try to see if there are any differences.
DanielM
Posts: 637
Joined: 28 Mar 2008, 06:37
Location: Sweden

Re: Scheduled events not executing

Post by DanielM »

Ok. Don't think I have much more useful to suggest now. Tell me if you need any more help.

Oh, btw, have you tried scheduling anything else? Maybe tro to schedule a job that just touches a file somewhere so you can easily see if it works?

/Daniel
gazza_d
Posts: 7
Joined: 20 Aug 2011, 07:10

Re: Scheduled events not executing

Post by gazza_d »

Yeh!! finally solved it!

An entry was missing from /etc/shadow for the www-data user

copied one of the other system user lines, and just changing the name resolved the issue and now my schedules are working.

Thanks very much Daniel for your time and efforts in trying to track this down., and pass my thanks on to Tom as well.

Gaz
Ubi
Posts: 1549
Joined: 17 Jul 2007, 09:01

Re: Scheduled events not executing

Post by Ubi »

hang on you manually edited etc/shadow to create a user? Why not just use useradd and do it properly?
DanielM
Posts: 637
Joined: 28 Mar 2008, 06:37
Location: Sweden

Re: Scheduled events not executing

Post by DanielM »

gazza_d wrote:An entry was missing from /etc/shadow for the www-data user
So there was an account without anything in shadow? That's strange...
gazza_d wrote: Thanks very much Daniel for your time and efforts in trying to track this down., and pass my thanks on to Tom as well.
No problem. Nice to hear that it works now :D

/Daniel
Post Reply