Community Forums
Connect with us on LinkedIn
+ Reply to Thread
Results 1 to 5 of 5
  1. #1
    Member
    Join Date
    Nov 2005
    Location
    South Coast of England
    Posts
    20

    Default Time between CRON jobs (is 20 seconds ok?)

    Hi all,

    I have a couple of php scripts that I need to run via CRON. I have them running fine and currently running every 15 minutes. I'll quickly explain what they do:

    One of them monitors an email address. If it finds an email with an image attached, it stores it in a specific folder;
    Second one checks that specific folder and then moves & renames the image to a naming convention I need, to another folder.

    Now it's a long story (which I won't bore you with) why I need both scripts running. Trouble is, if more than one image is emailed in in between the jobs running, when they run, the first job does what is should, but then the second job only picks up the first image and then deletes anymore images.

    So that's what the jobs do...My questions are:

    Would it be ok to run these jobs say every 20 seconds? - Would it hammer my server too much?

    I'm thinking of modifying the jobs to loop 4 times every 20 seconds and then just setting the CRON to be every minute...Would that be a better way?

    Thanks for any help/advice.

  2. #2
    Member PWSowner's Avatar
    Join Date
    Nov 2001
    Location
    ON, Canada
    Posts
    2,994

    Default

    Only way to know for sure would be to try it, but it might make more sense to fix the scripts to deal with multiple cases.

    I have a script that runs every minute and does its job 3 times and it doesn't use any noticable power. It would depend on the script and the size of files it has to work with.
    Mike
    WHM and cPanel Scripts (join our "Scripts Club")
    D/A Photography

  3. #3
    Member
    Join Date
    Nov 2005
    Location
    South Coast of England
    Posts
    20

    Default

    Hi Mike,

    thanks for your reply I have to say, I tend to agree with what you say about fixing the scripts! However, in the short term, I think I may just give the 20 second CRON a go!

    Thanks again.

  4. #4
    Member PWSowner's Avatar
    Join Date
    Nov 2001
    Location
    ON, Canada
    Posts
    2,994

    Default

    If you have it loop every 20 seconds, make it only 3 times, otherwise a 4th time will be the same time the script is called again, causing it to run twice at the same time.
    Mike
    WHM and cPanel Scripts (join our "Scripts Club")
    D/A Photography

  5. #5
    Member
    Join Date
    Nov 2005
    Location
    South Coast of England
    Posts
    20

    Default

    Cheers - will do

Similar Threads & Tags
Similar threads

  1. Maximum Execution Time of 30 seconds..
    By DeadBeet in forum cPanel and WHM Discussions
    Replies: 3
    Last Post: 10-16-2008, 02:02 PM
  2. Cron jobs - Fatal error: Maximum execution time of 30 seconds exceeded
    By torres87 in forum cPanel and WHM Discussions
    Replies: 0
    Last Post: 10-03-2008, 02:32 AM
  3. Squirrelmail - Maximum execution time of 30 seconds exceeded
    By aingaranweb in forum cPanel and WHM Discussions
    Replies: 2
    Last Post: 03-21-2006, 10:37 PM
  4. cPanel cron jobs or cron.daily , cron.hourly , etc.?
    By spaceman in forum cPanel and WHM Discussions
    Replies: 6
    Last Post: 01-01-2004, 07:16 PM
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube