"Pseudo" cron job
am 16.10.2007 02:12:54 von Shelly
I am coding a psudo-cron job into an application that I am writing. I don't
have access to write a real cron job.
Here is what I did:
1 - I downloaded pseudocron.php from its website
(www.bitfolge.de/pseudocron)
2 - I created a cronjob directory and put a crontab.txt in there and had the
pseudocron.php hook up with it by properly configuring the section in that
script.
3 - I put an require_once("pseudocron.php") in my login screen so that when
the user logs in the script is run.
4 - The cronjob runs setRemind.php. All that does is set a session
variable, $_SESSION['remind'] to true.
5 - In my template file, which is on every page in the application, I test
on whether that variable is true or false. If it is false, I write
.
If it is true, I write
6 - The checkRemind.php accesses the database and sees if there are any
reminders to show the user. It also sets the session variable to false.
The crontab.txt has a line:
*/1 * * * Sun cronjobs/setRemind.php # repeat every one
minute
OK, other than the timer firing things, all works well. Initially, it opens
the reminder screen in a separate window and does what it should. After
that, changing pages does not invoke the check reminder screen. This is as
it should be.
Now for the problem.
The "cron" job should cause a firing every minute (I will set this at
something between one and 24 hours later, but it is one minute now for
debugging purposes). The problem is that it is not firing or, at least
appears not to be firing.
How can I debug this? How can I determine if this pseudocron job is
working? IOW, how can I see if there is a timer job running?
Shelly
Re: "Pseudo" cron job
am 16.10.2007 02:15:59 von Jerry Stuckle
Shelly wrote:
> I am coding a psudo-cron job into an application that I am writing. I don't
> have access to write a real cron job.
>
> Here is what I did:
> 1 - I downloaded pseudocron.php from its website
> (www.bitfolge.de/pseudocron)
> 2 - I created a cronjob directory and put a crontab.txt in there and had the
> pseudocron.php hook up with it by properly configuring the section in that
> script.
> 3 - I put an require_once("pseudocron.php") in my login screen so that when
> the user logs in the script is run.
> 4 - The cronjob runs setRemind.php. All that does is set a session
> variable, $_SESSION['remind'] to true.
> 5 - In my template file, which is on every page in the application, I test
> on whether that variable is true or false. If it is false, I write
.
> If it is true, I write
> 6 - The checkRemind.php accesses the database and sees if there are any
> reminders to show the user. It also sets the session variable to false.
>
> The crontab.txt has a line:
> */1 * * * Sun cronjobs/setRemind.php # repeat every one
> minute
>
> OK, other than the timer firing things, all works well. Initially, it opens
> the reminder screen in a separate window and does what it should. After
> that, changing pages does not invoke the check reminder screen. This is as
> it should be.
>
> Now for the problem.
> The "cron" job should cause a firing every minute (I will set this at
> something between one and 24 hours later, but it is one minute now for
> debugging purposes). The problem is that it is not firing or, at least
> appears not to be firing.
>
> How can I debug this? How can I determine if this pseudocron job is
> working? IOW, how can I see if there is a timer job running?
>
> Shelly
>
>
>
>
Shelly,
I suggest you take this up with the people you got the pseudo-cron job
from. They know their script; we don't.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
Re: "Pseudo" cron job
am 16.10.2007 02:40:24 von Shelly
"Shelly" wrote in message
news:13h80h0o146hled@corp.supernews.com...
>I am coding a psudo-cron job into an application that I am writing. I
>don't have access to write a real cron job.
>
> Here is what I did:
> 1 - I downloaded pseudocron.php from its website
> (www.bitfolge.de/pseudocron)
> 2 - I created a cronjob directory and put a crontab.txt in there and had
> the pseudocron.php hook up with it by properly configuring the section in
> that script.
> 3 - I put an require_once("pseudocron.php") in my login screen so that
> when the user logs in the script is run.
> 4 - The cronjob runs setRemind.php. All that does is set a session
> variable, $_SESSION['remind'] to true.
> 5 - In my template file, which is on every page in the application, I test
> on whether that variable is true or false. If it is false, I write
> . If it is true, I write
> onload="window.open("checkRemind.php")>
> 6 - The checkRemind.php accesses the database and sees if there are any
> reminders to show the user. It also sets the session variable to false.
>
> The crontab.txt has a line:
> */1 * * * Sun cronjobs/setRemind.php # repeat every
> one minute
>
> OK, other than the timer firing things, all works well. Initially, it
> opens the reminder screen in a separate window and does what it should.
> After that, changing pages does not invoke the check reminder screen.
> This is as it should be.
>
> Now for the problem.
> The "cron" job should cause a firing every minute (I will set this at
> something between one and 24 hours later, but it is one minute now for
> debugging purposes). The problem is that it is not firing or, at least
> appears not to be firing.
>
> How can I debug this? How can I determine if this pseudocron job is
> working? IOW, how can I see if there is a timer job running?
>
> Shelly
I thought I caught the error upon reading my post. The line in the
crontab.txt should be
*/1 * * * * cronjobs/setRemind.php # repeat every one
minute
The previous one would only fire on Sundays. I made the change, but it
still doesn't fire.
Shelly
Re: "Pseudo" cron job
am 16.10.2007 05:36:35 von oliver.graetz
Shelly schrieb:
>
> The crontab.txt has a line:
> */1 * * * Sun cronjobs/setRemind.php # repeat every one
> minute
>
> OK, other than the timer firing things, all works well. Initially, it opens
> the reminder screen in a separate window and does what it should. After
> that, changing pages does not invoke the check reminder screen. This is as
> it should be.
>
> Now for the problem.
> The "cron" job should cause a firing every minute (I will set this at
> something between one and 24 hours later, but it is one minute now for
> debugging purposes). The problem is that it is not firing or, at least
> appears not to be firing.
Excuse me if I'm totally wrong since I recall some cron similar problem
from long ago. I don't know if it was the bitfolge.de script but one of
the cron format parsers out there wasn't capable of recognising the "/n"
syntax for "every n". Try if just "*" instead of "*/1" fires and if yes,
then you have to give it a "5,10,15,..." instead of "*/5".
OLLi
--
Never store a bit of data in more than one object.
Re: "Pseudo" cron job
am 17.10.2007 00:18:24 von Shelly
"Oliver Grätz" wrote in message
news:471431C3.9040009@gmx.de...
> Shelly schrieb:
>>
>> The crontab.txt has a line:
>> */1 * * * Sun cronjobs/setRemind.php # repeat every
>> one
>> minute
>>
>> OK, other than the timer firing things, all works well. Initially, it
>> opens
>> the reminder screen in a separate window and does what it should. After
>> that, changing pages does not invoke the check reminder screen. This is
>> as
>> it should be.
>>
>> Now for the problem.
>> The "cron" job should cause a firing every minute (I will set this at
>> something between one and 24 hours later, but it is one minute now for
>> debugging purposes). The problem is that it is not firing or, at least
>> appears not to be firing.
>
> Excuse me if I'm totally wrong since I recall some cron similar problem
> from long ago. I don't know if it was the bitfolge.de script but one of
> the cron format parsers out there wasn't capable of recognising the "/n"
> syntax for "every n". Try if just "*" instead of "*/1" fires and if yes,
> then you have to give it a "5,10,15,..." instead of "*/5".
That didn't work either. I decided to ditch the whole thing and follow the
K.I.S.S. principle AKA Occam's Razor. I put in a javascript function call
to a routine where I open the new window and call a setTimeout by calling
itself. IOW:
function remindTimer() {
var t;
window.open("checkRemind.php");
t = setTimeout("remindTimer()", 60000);
}
This does the trick.
So much trouble for so little needed :-)
Shelly