How can I play a sound when script execution is ready?
Append any command that plays a sound; this could be as simple as
$ time mycommand; printf '\7'
or as complex as
$ time mycommand && paplay itworked.ogg || paplay bombed.ogg
(Commands assume pulseaudio is installed; substitute your sound player, which will depend on your desktop environment.)
spd-say
sleep 2; spd-say 'get back to work'
Infinite loop with -w
if you need extra motivation:
sleep 2; while true; do spd-say -w 'get back to work'; done
Pre-installed on 14.04 via package speech-dispatcher
: http://releases.ubuntu.com/trusty/ubuntu-14.04.4-desktop-amd64.manifest for blind people I suppose?
Also add a popup
This combo is a life saver (b
stands for beep
):
b() ( spd-say 'done'; zenity --info --text "$(date);$(pwd)" & )
and then:
super-slow-command;b
If I'm somewhere in the room, I'll hear it and know that the long job is done.
Otherwise, I'll see the popup when I get back to my computer.
Related: https://stackoverflow.com/questions/7035/how-to-show-a-gui-message-box-from-a-bash-script-in-linux
Just pick a sound on your hard drive, and put a command to play it right after the command you're waiting on; they'll happen sequentially:
$ time python MyScript.py; mplayer ~/ScriptDone.wav
(You can use any player, naturally). I have a script called alertdone
that plays a tone and shows an libnotify alert when run; I use it for exactly this occasion:
$ time python MyScript.py; alertdone "Done timing"
It's really simple, so if you want to make your own you can base it on this (mine requires notify-more
, mplayer
, and ~/tones/alert_1.wav
though):
#!/bin/bash
message=${1:-"Finished working"}
notify-more -t 10000 -i /usr/share/icons/gnome/32x32/actions/insert-object.png "Process Finished" "$message"
mplayer ~/tones/alert_1.wav