Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 576285
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T14:01:52+00:00 2026-05-13T14:01:52+00:00

I’m planning to sync 2 folders from 2 dyfferent servers using a cronjob scheduled

  • 0

I’m planning to sync 2 folders from 2 dyfferent servers using a cronjob scheduled to run every hour.
The script that is to be scheduled will check if a previous instance is already running, and if not, continue with processing.

so, the first stage is to sync these folders. Daily (or more often), the second server will have 1-2 thousands of new files added, that need to be moved onto the first server and processed.

The processing will be handled by PHP. it will open each file, read each row and add it to a database.

What i’d like to do is use the same cron that syncs folders to call the PHP script to parse the files. But since i don’t know how long it’ll take to process that many files, I’d like to impose a limit on the number of files PHP handles on each request.

If no limit is added to the PHP script (number of files / each request), it could easily reach a timeout.

The question is: is there a way i can keep looping and call this PHP script until it finishes processing? Ideally when both wget (folder sync) and PHP will finish, the lock will be removed so a new instance of the cron can run.

Any suggestion is welcomed,
thank you

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T14:01:52+00:00Added an answer on May 13, 2026 at 2:01 pm

    You can place a header() at the end of the script and use GET parameters to control the execution flow. For example:

    parse.php?action=1

    In script:

    
    switch ($_GET["action"])
    {
    case 1:
     //action 1 goes here
     header("Location: ...");
     exit();
    break;
    case 2:
     //action 2 goes here
     header("Location: ...");
    break;
    }
     exit();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

That's pretty much it. I'm using Nokogiri to scrape a web page what has
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I've got a string that has curly quotes in it. I'd like to replace
I am reading a book about Javascript and jQuery and using one of the
I have a French site that I want to parse, but am running into
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I am doing a simple coin flipping experiment for class that involves flipping a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.