DEV Community

Cover image for What is your top interesting cron job for your daily life? 🤯
Cyril Niobé
Cyril Niobé

Posted on

What is your top interesting cron job for your daily life? 🤯

As developers, we are lucky to be able to use our own skills and knowledge to improve our life.

And I recently dug into about cron jobs and how impactful and time saving they can be in our daily life.

🧐 I'm curious on which ones you used daily (in a personal or professional way it does not matter!)

💪 Share us your best ones to give us some ideas to build around.
Any public repo are welcome!

🤩 I would love to find somewhere a curated list of best cron jobs ideas to setup during spare time! (might start a collaborative repo on this topic?)

Personally, I'm starting by setting up a cron job to backup every day my computer files into my NAS.

Do you have any favorite cron jobs that you are frequently using?

Top comments (18)

Collapse
 
jmfayard profile image
Jean-Michel 🕵🏻‍♂️ Fayard

A good one is to send to yourself a reminder to stop working at a given hour

Collapse
 
mike_hasarms profile image
Mike Healy

I have a randomized one to tell me to eat less sugar. Sometimes I get the email as I'm arriving at the supermarket :)

Collapse
 
cyril profile image
Cyril Niobé

Nice one ahah.

Collapse
 
wesweswesweswes profile image
Wes Martin

I have one that runs a node script on a Pi just after midnight every night to (1) obtain the sunrise and sunset times for the day, and (2) set a schedule for my Philips Hue lights based on those values!

Collapse
 
jankislinger profile image
Jan Kislinger

'docker system prune -f' every 5 minutes

Collapse
 
graemeq profile image
Graeme Q

For me, I have one that restarts a node instance. We have to use Oracle and the drivers have a memory leak. This in turn means, on our Dev and UAT machines, they start to hang within 2 hours. It used to be I manually restarted them.

I now just have a cron job that restarts the servers regardless on the hour, every hour. That in itself opens other issues but at least I don't need to be present 24/7.

Oh, and if you're wondering, Oracle Support is terrible.

Collapse
 
michaelcurrin profile image
Michael Currin

Ah, interesting question. I'm enjoying the other responses. I want to share 3 of my cron-related projects.

scrape_pages_with_curl.sh I'm interested in scraping data from certain news and property sites to understand the water crisis in my city. I've done that for over a year.

twitterverse I download Twitter API data daily using a tool I wrote. I run it to fetch trend data from countries and cities. And also to get tweets for a couple of search queries of interest to me and friends.

uni-cron Unfortunately, crontab alone can't run them reliably on a laptop which is not always on and online. And running all jobs hourly (when they only need to run once a day) is overkill for resources, but that's what I've been today. But, as of yesterday, I have a tool what integrates with crontab that will run your tasks exactly once a day and will keep retrying them throughout the day if they fail. Keen to hear thoughts on this! Or to find if there is a solution for Mac out there already.

Collapse
 
miroslavglamuzina profile image
Miroslav Glamuzina • Edited

I got one to open and close my blinds (RPI); once in the morning and once at night.

Collapse
 
skryking profile image
Jason Ormes

I have one that scrapes lottery numbers off a website and emails them to me because I'm to lazy to open a web browser and go look at them.

Collapse
 
cyril profile image
Cyril Niobé

And did you win since then? 😁

Collapse
 
skryking profile image
Jason Ormes

Alas no, I still have to go to work tomorrow.

Collapse
 
deepspace2 profile image
Adi Vaknin • Edited

I wrote myself a telegram bot that scrapes the website of my favorite football team to get the matches schedule, then it sends them to me as a message then adds them to google calendar

Collapse
 
cyril profile image
Cyril Niobé

Excellent! 🤟 I made exactly the same for my amateur handball club to scrape their results!

Collapse
 
neudabei profile image
Robert

I use a daily cronjob to pull all my bookmarks from pinboard and export them to CSV. That way I have a backup of my data and I can grep through it together with other notes.

gist.github.com/neudabei/ba78dd562...

Collapse
 
ledestin profile image
Dmitry Maksyoma

My cron jobs mail me stuff:

  • a link to a file in Downloads folder to review. I don't fancy reviewing lots of files at once.
  • a random recipe. It's a actually a link to a site that yields a random recipe. So, it's just a reminder.
  • once a week, I get a list of random foods, so that I can consider incorporating them into my diet.