BASH Pushover Notifications

A few days ago, I started a process that involves very heavy file processing operations that take anywhere from 10 minutes on the low side to 30 minutes on the high side. Wanting to be as efficient as possible and not let the computer sit idle for any meaningful length of time, and since the range of time varies so widely, I found myself wandering back to my computer every few minutes to see how things were progressing. After a day of this I became very frustrated and since I expect this to be a fairly extended activity, I decided to set up a system to notify me when the operations were complete so I could go about my business without wondering about the current operation status.


The file processing exercise itself leverages a GTK based GUI tool but does not provide any kind of mechanism for notifications such as Growl. The processing tool is open source, so I could try to build my own hooks into the tool, but I’m all about finding an easy solution. I’m always more comfortable at the command line anyway, so I decided that a simple BASH script was the best solution for my needs.

The workflow for each file is as follows:

  1. load file into my GUI program
  2. set parameters, including output filename
  3. initiate processing operation

Once this is complete, my thought was to then jump to my terminal window and simply execute my script and pass the output file defined above as a parameter – EASY!

Build the script

In order to write the script open your terminal and navigate to your home directory and fire up vim or nano and follow along.


while [ $(( $(date +%s) - $(stat -c %Y FILENAME) )) -lt 10 ]; /
   do sleep 1; done; echo DONE

Line 3 captures the filename parameter that’s passed in on the command line. Line 4 is where the magic of this script occurs. Since my file processing routine updates its output file in real-time, the modification date for that file is constantly updated. The loop we see in line 4 checks that modification date and stays at this point in the script until it sees a 10 second gap between the current time and the last time the file was updated. Once that condition is met, we can safely assume that the file processing operation is complete.

TITLE="Job Complete"

curl -s -F "token=$APP_TOKEN" /
   -F "user=$USER_TOKEN" /
   -F "title=$TITLE" /
   -F "message=$MESSAGE"

The remainder of the script is the code required to send a notification to my phone via Pushover. If you’re reading this post, I assume you’re familiar with Pushover, so I won’t delve into the details. If you’re not familiar with the service, you can read more about it at their website.

Now same the script as and run the following command:

chmod +x

Wrapping it up

Now that we have our monitoring script, we can extend our workflow as follows:

  1. load file into my GUI program
  2. set parameters, including output filename
  3. initiate processing operation
  4. open a terminal
  5. run the following command – ./ /path/to/

Until next time – GEEK OUT!


Leave a Reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload the CAPTCHA.