Skip to content

My cron job overlapped with the previous run and the output file was corrupted

tom_hartley0 views

A script runs every 15 minutes from cron. Last week one run took 25 minutes, the next one started while it was still going, and both wrote to the same file.

How do I stop a second copy from starting while the first is still running?

Loading the replies

Your reply

Be kind and specific. Read the community guidelines.

Choose what we may use. You can change this at any time with “Privacy choices” at the foot of every page. Details are in the Cookie policy and the Privacy policy.

Strictly necessary

Remembers your theme, the lessons you marked as done and this choice. It stays on your device, tracks nothing and cannot be switched off.

Always on
What exactly is collected, and why

Grokem’s own counts

Collects
The pages you open and how long you stay, how far you scroll, where you came from, your device type, browser, screen size, language and time zone. Your IP address is turned into a code that changes every day; it is never stored as it is.
Why
To see how long lessons are read and where readers leave. Not shared with anyone.
Stored
A random visitor ID, a visit ID and the time of your last page view in your browser’s storage (gr_vid, gr_sid, gr_last). No name or email is attached.
My cron job overlapped with the previous run and the output file was corrupted | Grokem