Answer the question
In order to leave comments, you need to log in
How to step through a script in CRON?
Good afternoon,
I am uploading data to the site database from a third-party resource.
Unloading must be done periodically.
Sometimes the amount of data transferred is very large.
The unloading algorithm is as follows:
1. Request to the service API, writes data to a temporary file on the server. Next, we work with the file.
2. Upon successful entry of each element into the database, the element is removed from the file's data array.
3. question: how to interrupt the execution of a script launched by cron for a while, and then start reading this file further?
If I do a recursive run of the import via exec every N steps, would that help?
Thank you.
Answer the question
In order to leave comments, you need to log in
You can write the current time to a file / database when the script ends. And at each start, read this time, and if enough has passed, then start, otherwise exit. If I understand the question correctly.
If the script should just pause for a while during execution, then sleep can help.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question