DEV Community

Cover image for Notify Yourself After Completing a Long-Running Bash Process
Olufisayo Bamidele
Olufisayo Bamidele

Posted on

Notify Yourself After Completing a Long-Running Bash Process

Recently, I worked on projects that take a long time to build. I often stared at the screen, waiting for these to complete, which often resulted in me sleeping off at my desk. Later, I improvised sleeping while listening to some podcasts, but I usually lost valuable time since I couldn't tell when the long-running tasks were done. If only I could get notified if a bash process is done.

Say hello to the "say" command

The say command takes a string of text and reads it out loud. The example below says "brew upgrade done" when you're done upgrading your brew packages.

brew upgrade; say, "brew upgrade done."
Enter fullscreen mode Exit fullscreen mode

Perhaps you often sleep off while listening to one of those monotonic dialogues between Lex Fridman and Elon; you could repeat the alert until you wake up with a little sprinkle of bash.

brew upgrade; for i in {1..1000}; do; say "brew upgrade done"; done;
Enter fullscreen mode Exit fullscreen mode

That would say "brew upgrade done" 1000 times unless you manually stop it(with ctrl+c).

If you don't wake up after 1000 iterations, you should close your laptop for the weekend sleep. Just sleep 😆.

ℹ️ The say command comes preinstalled with Macos (I think), but its equivalent should be available on your Linux distro. For example, on my Ubuntu desktop installation, I have spd-say.

Alright, that's it. Have a great weekend, you all.

Image of Docusign

Bring your solution into Docusign. Reach over 1.6M customers.

Docusign is now extensible. Overcome challenges with disconnected products and inaccessible data by bringing your solutions into Docusign and publishing to 1.6M customers in the App Center.

Learn more

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Discover a treasure trove of wisdom within this insightful piece, highly respected in the nurturing DEV Community enviroment. Developers, whether novice or expert, are encouraged to participate and add to our shared knowledge basin.

A simple "thank you" can illuminate someone's day. Express your appreciation in the comments section!

On DEV, sharing ideas smoothens our journey and strengthens our community ties. Learn something useful? Offering a quick thanks to the author is deeply appreciated.

Okay