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
Scheduled events not executing
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)
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)
Re: Scheduled events not executing
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
/Daniel
Re: Scheduled events not executing
Hi Daniel
as www-data, I initially get an authentication error, but it is ignored, and stuff seems to work.
crontab -l returns:
running the php command as www-data returns:
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)
Code: Select all
$ crontab -l
01 00 * * * /usr/bin//php /var/www/HomeAutomation/run.php command=updateschedules >/dev/null 2>&1
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
$
Re: Scheduled events not executing
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
And by the way, what does /etc/crontab contain?
/Daniel
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
/Daniel
Re: Scheduled events not executing
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.
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.
Re: Scheduled events not executing
Yep, the Bubba is a fantastic machine, I can recommend itgazza_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.
![Very Happy :D](./images/smilies/icon_e_biggrin.gif)
What does the file in the atspool directory contain more exactly?
/Daniel
Re: Scheduled events not executing
Each job file in atspool contains only the following details
Code: Select all
Subject: Output from your job 39
To: www-data
Re: Scheduled events not executing
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.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
/Daniel
Re: Scheduled events not executing
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.
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.
Re: Scheduled events not executing
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
Also note that B3 is also armel and it works perfectly, so it's not just the architecture that's the problem.
/Daniel
Re: Scheduled events not executing
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.
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.
Re: Scheduled events not executing
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
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
Re: Scheduled events not executing
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
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
Re: Scheduled events not executing
hang on you manually edited etc/shadow to create a user? Why not just use useradd and do it properly?
Re: Scheduled events not executing
So there was an account without anything in shadow? That's strange...gazza_d wrote:An entry was missing from /etc/shadow for the www-data user
No problem. Nice to hear that it works nowgazza_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.
![Very Happy :D](./images/smilies/icon_e_biggrin.gif)
/Daniel