473,396 Members | 1,942 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

"Pseudo" cron job

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 <body>.
If it is true, I write <body 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

Oct 16 '07 #1
4 5634
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 <body>.
If it is true, I write <body 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

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.
js*******@attglobal.net
==================

Oct 16 '07 #2

"Shelly" <sh************@asap-consult.comwrote in message
news:13*************@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
<body>. If it is true, I write <body
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
Oct 16 '07 #3
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.
Oct 16 '07 #4

"Oliver Grätz" <ol***********@gmx.dewrote in message
news:47**************@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
Oct 16 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Andrew E | last post by:
Hi all I've written a python program that adds orders into our order routing simulation system. It works well, and has a syntax along these lines: ./neworder --instrument NOKIA --size 23...
0
by: Kurt.Gerber | last post by:
I use Postgresql 7.2.1 on Debian Linux 3.0r1. I have tried to create a RULE exactly as described in the &quot;Postgresql Programmers Manual&quot;. Code: CREATE RULE foo_rule AS ON UPDATE TO foo WHERE...
6
by: Zhang Weiwu | last post by:
Hello. I am working with a php software project, in it (www.egroupware.org) Chinese simplified locate is "zh" while Traditional Chinese "tw". I wish to send correct language attribute in http...
7
by: Will Hartung | last post by:
I have this: <a class="pink_link" href="faq.html#q1">Go to question 1</a> And the CSS is simply: ..pink_link {color: #fa61b7; font-weight: bold;} So, I'm curious why my links are blue and...
1
by: Lars Erik Thorsplass | last post by:
I have recently ventured into the exciting world of stored procedures, but I have now become lost. Background: Am currently working on access control in a web application. My goal is to...
6
by: kelvlam | last post by:
Hello, I'm a new begininer with JavaScript. I'm trying to figure out which is the best approach, and to understand the differences between them. I have a <Aelement that's suppose to either...
3
by: jonnyblazed | last post by:
I've searched everywhere for this but I'm not sure exactly what to search for. What I am trying to do is pass a variable to a php script via the URL. However, I don't want to use the standard...
12
by: Matthew Wilson | last post by:
Hi, we are getting a lot of spam through our PHP Feedback form, and have set up a new field 'prove you're human', asking them to do some simple maths. What is the command for the PHP script...
4
by: k3pp0 | last post by:
Hey. I've got a very basic newbie question, I hope you can understand me. Sorry for asking it, first of all. I see a lot of sites (e.g. communities) with a url-structure like this:...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.