Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Cron Jobs

by kidd (Curate)
on Oct 06, 2002 at 23:39 UTC ( #203224=perlquestion: print w/ replies, xml ) Need Help??
kidd has asked for the wisdom of the Perl Monks concerning the following question:

Hello monks...

Here I am again looking for a little wisdom from all of you. Finally I got my first work here in Mexico with a big company like a month ago, and I have made some projects with them. And three days ago they asked me to do a new project wich Ill explain:

The Project: The company has a lot of people around the country that gather information. What they want me to do is create an interface in which each one will have an accouny where they'll log on and enter the information they have gathered through the day.

There will be a special interface for the director of the project in which he will decide at what time he wants the email sent to him (I personally dont uderstand why they want the EMAIL instead of login to a special web-page in which they'll see the information - but you know how they are-).


Solutions: Right now Im done with the interface part and its working fine. But now Im stucked with the director's interface.

Since Im working on a UNIX based server I decided to solve the email problem with cron jobs, but I can't get them to work. I don't know how to configure the cron jobs through perl.

I read about the module Schedule::Cron but I dont understand it well enough.

I was hoping someone could help me out with some ideas or links to where I can find some more documentation for this task. The due date for this project is on Friday and Im hoping Im able to do it.

Well...I would like to say thanks in advanced to all those who can help me out a little bit.

Comment on Cron Jobs
Re: Cron Jobs
by Felonious (Chaplain) on Oct 07, 2002 at 01:19 UTC
    Hi,
    It's not clear to me why you need perl to "configure cron". If you don't yet understand cron, I'd stay away from Schedule::Cron until it's clear to you why you'd need it. If cron is really what you need for the job, it should be a one time setup. "man -a crontab" should get you started.

    [TINPC@perlcabal.com shh]$ su real
      From the original question:
      There will be a special interface for the director of the project in which he will decide at what time he wants the email sent to him
      This says to me that the code running the director's interface needs to schedule the reporting program (which sends the email) to be run at a time specified by the director, i.e. configure a cron job to run it at the required time. And presumably the director is free to change this, so a one-time setup of cron will not work.

      kidd, try reading the man page for the at command. This would be an easier way to do scheduling - just use backticks to call at. You could set the reporting program to reschedule itself each time it is run.

      An alternative approach would be for the director's interface to accept a time and store this in a file or database somewhere. Have your reporting program check this file on startup and only send the email if the current time = the requested time. Then use cron to run this script at frequent intervals, say every 5 minutes.

      JJ

Re: Cron Jobs
by dbp (Pilgrim) on Oct 07, 2002 at 05:57 UTC
    Try to be a little more specific. What exactly do you want to do with cron? Why is this a Perl issue? Is it because the director's interface is a web form that you are parsing with Perl? Let me also second the motion that you read the cron man page before worrying about Schedule::Cron. Most importantly, note that Schedule::Cron is not a module for accessing your system's cron scheduler; it is for doing cron-like scheduling within a Perl program. I'm guessing that it will be cleaner to modify cron by hand to call a little perl script that will take the daily entries and pack them up in an email for the director. Mail::Send is a nice module for this sort of thing.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (9)
As of 2014-08-23 17:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (175 votes), past polls