How to Create a Simple Alert for Long-Running Jobs

If you are tired of executing long-running commands and having to wait idly for the result, you can set up a simple alert system to get notified when the task is finished.

Photo by rhoda alex on Unsplash

Whether you are running a long Machine Learning training task, analyzing a load of data, or executing a long simulation, this alert enables you to step away from the computer and get notified when to come back.

In this article, I show you how to install a simple Python script that will send you a message on a Slack channel, Discord channel, or anything else. I use this often in my work and I hope it will be useful to you too.

This guide is created for Linux, but can also be installed for Mac or Windows as long as you can get Python.

The alert works by using the knockknock library in Python. The main alert file in the repository is only 17 lines of code!

Set up the alert in 6 easy steps

git clone
sudo pip install setuptools-rust
python -m pip install — upgrade pip
python -m pip install -r requirements.txt

To do this, check out

In the file alert , update the variables to your webhook URL and default channel.

# alert

DEFAULT_SLACK_CHANNEL = 'your-slack-channel'
chmod +x alert
cp alert ~/alert

Now you can use ~/alert with any long task!

For example, from any folder, you can do:

~/some-folder$ python && ~/alert

Finally, you can set a custom message after the ~alert command:

~/alert hello


In this article, I have written about a simple alert system that I personally use often and install in almost every machine I work with.

If you enjoyed this article or learned something from it, I would appreciate your clap!

If you also have anything to suggest, let me know in the comments or message me on LinkedIn!



Award-Winning Software Engineer | Business and Web Consultant

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store