đŸŠ„Cron For Dummies

Hello friends!

Welcome to this week’s Sloth Bytes. I hope you had a great week 😃 

Yeah I could code a landing page, but why would I?

Even with HTML, CSS, Tailwind, and a few AI tools, it still takes hours to make something that works across screen sizes, has good SEO, and doesn’t look like garbage.

I’m also pretty lazy.

Framer still gives me full creative control, but it also has other helpful tools to speed up development so I can go back to building.

When you hit publish, it’s live: SEO-optimized, blazingly fast, and fully responsive.

Need beautiful animations? Just drag a slider or click a button.

A/B testing, a real CMS, one-click localization, and integrations with other software.

Yeah I still code, but for landing pages, portfolios, and marketing sites?

Try it for free and since you’re a Sloth Bytes reader you’ll also get a free month of Framer Pro with code CODINGSLOTH2025.

Cron For Dummies

I always wondered how a lot of apps/programs sent weekly reminders and emails.

Did they manually send it every time?

Well
 no obviously. Programmers hate the word “manual” with a passion.

If something can be automated, some programmer will figure it out.

And they did.

They created Cron and It’s been running millions of automated tasks since 1975.

What is Cron?

Cron runs commands automatically at specified times:

  • Backup databases every night at 2 AM

  • Send reports every Monday at 9 AM

  • Clean up old files every Sunday

  • Check if your website is up every 5 minutes

The name comes from "chronos" (Greek for time). It's literally Father Time for computers.

The Original Cron

Cron started off as a shell command that uses an interesting syntax to define when tasks should run.

  * * * * * /home/sloth/scripts/make_newsletter.sh
# | | | | |
# | | | | day of the week (0–6) (Sunday to Saturday; 
# | | | month (1–12) 7 is also Sunday on some systems)
# | | day of the month (1–31)
# | hour (0–23)
# minute (0–59)

This was revolutionary for its time!

Computers could finally do things automatically on schedule. System administrators could go home knowing backups would run at 2 AM without them.

Common Examples

# Every day at 2:30 AM
30 2 * * * /backup/daily-backup.sh

# Every Monday at 9 AM
0 9 * * 1 /send/weekly-report.py

# Every 5 minutes  
*/5 * * * * /check/server-health.sh

The syntax might take a little bit to learn, but check this resource out if you want to play with it:

Why Cron Jobs Matter

  • Humans forget, computers don't.

  • Off-hours automation: Run heavy tasks when users aren't active.

  • Consistent monitoring: Health checks and alerts that never sleep.

Modern Alternatives

Cron has evolved over the years to the point where a lot of tools do it automatically for you!

But if you need to do custom workflows/cron jobs you can do that with modern tools instead of using the shell.

  • GitHub Actions

  • Vercel

  • AWS, Google Cloud, Azure, etc

There’s a lot more options


The Modern Reality

A lot of modern programs depends on scheduled tasks:

  • Email campaigns scheduled for optimal send times

  • Automated nightly backups protecting critical data

  • SSL certificates renewed before expiration

  • Analytics reports compiled and delivered automatically

  • Security scans running during off-peak hours

When Should You Use Cron Jobs?

Some reasons for cron jobs:

  • Database backups and cleanup tasks

  • Log rotation and system maintenance

  • Sending periodic reports or notifications

  • Health checks and monitoring scripts

  • Data synchronization between systems

The best cron job is one you set up once and forget about, until you desperately need the results it's been quietly producing.

Thanks for the feedback!

Thanks to everyone who submitted!

Cinemas

Given an array of seats, return the maximum number of new people which can be seated, as long as there is at least a gap of 2 seats between people.

  • Empty seats are given as 0.

  • Occupied seats are given as 1.

  • Don't move any seats which are already occupied, even if they are less than 2 seats apart. Consider only the gaps between new seats and existing seats.

Examples

maximumSeating([0, 0, 0, 1, 0, 0, 1, 0, 0, 0])
output = 2
# [1, 0, 0, 1, 0, 0, 1, 0, 0, 1] 2 new people were seated!

maximumSeating([0, 0, 0, 0])
output = 2
# [1, 0, 0, 1] 2 new people were seated!

maximumSeating([1, 0, 0, 0, 0, 1])
output = 0
# There is no way to have a gap of at least 2 chairs when adding someone else.

maximumSeating([0, 0, 0, 1, 0, 0, 1, 0, 0, 0])
output = 2

maximumSeating([0, 0, 0, 0, 0, 0, 0, 0, 0, 0])
output = 4

Reply with

  • A link to your solution (github, twitter, personal blog, portfolio, replit, etc)

  • or if you’re on the web version leave a comment!

  • If you want to be mentioned here, I’d prefer if you sent a GitHub link or Replit!

NEW VIDEO!

That’s all from me!

Have a great week, be safe, make good choices, and have fun coding.

If I made a mistake or you have any questions, feel free to comment below or reply to the email!

See you all next week.

What'd you think of today's email?

Login or Subscribe to participate in polls.

Want to advertise in Sloth Bytes?

If your company is interested in reaching an audience of developers and programming enthusiasts, you may want to advertise with us here.

Reply

or to participate.