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.

Sentry image

Hands-on debugging session: instrument, monitor, and fix

Join Lazar for a hands-on session where you’ll build it, break it, debug it, and fix it. You’ll set up Sentry, track errors, use Session Replay and Tracing, and leverage some good ol’ AI to find and fix issues fast.

RSVP here →

Top comments (0)

The Most Contextual AI Development Assistant

Pieces.app image

Our centralized storage agent works on-device, unifying various developer tools to proactively capture and enrich useful materials, streamline collaboration, and solve complex problems through a contextual understanding of your unique workflow.

👥 Ideal for solo developers, teams, and cross-company projects

Learn more