Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: Accessing cron job output from a web page?

by jhourcle (Prior)
on Apr 20, 2006 at 13:07 UTC ( #544590=note: print w/replies, xml ) Need Help??


in reply to Accessing cron job output from a web page?

I think it really depends on what sort of work the cron jobs are doing.

For instance, I once had a system where people could request accounts to be created / modified / whatever ... and instead of giving the webserver direct access to do things, it wrote files to a queue to be a processed. Once every 5 minutes, the files in the queue were checked, and processed (well, after the cron job checked to make sure the process wasn't still running from the last time it was kicked off)

As it's annoying to get e-mails every 5 minutes, each of the sub-tasks got logged to a seperate file (eg, new user accounts, new organizational accounts, new user accounts that were forced in by the helpdesk, changes in associations between user & org accounts, modifications to org accounts, etc, etc.). Every hour during the work day, and less frequently at night, another process looked through the log files, and generated a report -- errors first, then other non-normal events (eg, people forcing accounts through, items in the queue that were more than an hour old and hadn't been processed, etc.). If there weren't any changes in that hour, it didn't report anything. (which was typical through most of the year ... it was a university, so most people came in at the change of semesters).

The only time that the cron job that ran every 5 minutes would report immediately is if something really bad happened. (eg, couldn't connect to the LDAP server or the other databases, or couldn't FTP necessary files to the host where the account was being created, or the process that started 5 minutes before was still active)

  • Comment on Re: Accessing cron job output from a web page?

Replies are listed 'Best First'.
Re^2: Accessing cron job output from a web page?
by OfficeLinebacker (Chaplain) on Apr 20, 2006 at 14:06 UTC
    The cron jobs generally deal with downloading or reading financial/economic information, doing stuff with it, loading the modified or subsetted data into another db, and usually creating a chart or graph, distilling it, and posting it to a web site. Generally we're only worried about errors. The non-eroneous output is mainly useful to see what "normal" is when there IS an error. Also, there are several jobs that have dependencies, so we do want to be notified ASAP if there is an error. I guess one thing we need to consider is how to distribute the work between the wrapper script and the web site posting script. If we do CGI, we might need three scripts: the wrapper, the error-checker, and the CGI. The more I think about it, the static, every five minutes approach is probably better. I don't think I want to do much with the wrapper script, as I want to keep that as simple as possible so a minimum of errors are introduced by it. Thanks to all.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://544590]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (3)
As of 2020-07-10 03:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?