Thirty Nights
You'll keep a scheduled job running for thirty nights straight, with a log, a lock, an alert and log rotation.
About
A cron job that works once is easy. One that keeps working for a month is the real skill. It needs a log you can read, a lock so two copies don't overlap, an alert when it fails, and rotation so it doesn't fill the disk. Thirty consecutive nights shows you handled the sleeping laptop, the expired token and the full disk, or at least two of the three.
At a glance
- Per requirement
- 35 XP
- Completion bonus
- 300 XP
- Requirements
- 6
- Takes
- A month
- Skill level
- Intermediate (months of practice)
- Cost
- Free
- Supplies
- You need some
- Where
- At home
- Other people
- On your own
Requirements
-
1
Pick a job that does something useful nightly and run it from a machine that stays on. A desktop that never sleeps, a cheap always-on box or a free cloud schedule like a GitHub Actions cron trigger all work. Laptops are the number one reason nightly jobs miss, so leave yours out of this one. Take a screenshot of the schedule and where it runs. Photo
-
2
Log every run with a timestamp, what it did, and how long it took. One line per run is the minimum: when it started, when it finished, how many things it processed and how many seconds it took. Write to a dated log file. Take a screenshot of a week of lines. Photo
-
3
Add a lock so a slow run can't overlap the next one. Use flock on Linux or a pid file anywhere. Test it by making the job sleep for two minutes and scheduling it every minute, and the second copy should refuse to start. Take a screenshot of the refusal in the log. Photo
-
4
Send yourself an alert when the job fails or doesn't run at all. A failure alert is the easy half. The didn't-run alert is harder, so use a dead man's switch service, or a second job that checks the first one's log is fresh. Break the job on purpose and watch the alert arrive. Take a screenshot of the alert. Photo
-
5
Rotate the logs so they don't grow forever. Use logrotate, or write one file per day and delete anything older than 30 days. Take a screenshot of the log folder with the old ones gone. Photo
-
6
Show thirty consecutive nights in the log with no gaps. That's one run per night and 30 timestamps. If a night was missed, work out why, fix it, and start the count again. Take a screenshot of the full list. Photo