maxfowler
maxfowler

Reputation: 1318

Is there a way to configure a terminal to make a noise when it finishes executing a command?

When I am waiting for a long running command to finish I often go browse the internet etc.

But periodically I check back on my terminal window to see if it's finished executing. This is annoying.

Is there a way to make the terminal make a noise when a command finishes? Or use something else to emulate this effect?

Upvotes: 0

Views: 104

Answers (2)

maxfowler
maxfowler

Reputation: 1318

I figured out a solution that works for me.

some_command; do_stuff_to_notify_me

semi-colon is all I needed!

I ended up writing a tiny python script to send me a text.

Script to frolick in the meadow while you wait for your other scripts to finish:

import smtplib
server = smtplib.SMTP( "smtp.gmail.com", 587 )
server.starttls()
server.login( '<your_email>', '<your_password>' )

import urllib2
random_word_url = "http://randomword.setgetgo.com/get.php"
response = urllib2.urlopen(random_word_url);
random_word = response.read()

server.sendmail( '<from>', '<your_phone_number>@mms.att.net', 'Finished your script ' + random_word )

Upvotes: 0

sat
sat

Reputation: 14949

Try this,

sat:~# command || play somefile.wav

Or

sat:~# command || zenity --info --title "Alert"  --text "Job Completed"

If you care about the command status, then use && for success completion of command and || for failure completion.

Upvotes: 1

Related Questions