LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Notification in Linux. (https://www.linuxquestions.org/questions/linux-newbie-8/notification-in-linux-4175599516/)

hack3rcon 02-11-2017 08:59 AM

Notification in Linux.
 
Hello.
When a task finished I like Linux notify me, How can I do it? For example, I'm downloading a file via "wget" and when it is finished then Linux notify me.

Thank you.

JeremyBoden 02-11-2017 09:29 AM

A command line does so by asking for the next command.

But you could always do something like
Code:

wget URL && echo "finished"

Turbocapitalist 02-11-2017 09:47 AM

You can also have a graphical notice pop up. There is usually some such utility like xmessage, zenity, or another pre-installed.

Code:

wget $url && zenity --info --text="Download Complete" || zenity --info --text="Failed to Download"

wget $url && xmessage -buttons 'OK' 'Download Complete' || xmessage -buttons 'OK' 'Failed to Download'


hydrurga 02-11-2017 10:04 AM

Alternatively:

wget URL && beep

Refer to this page for some caveats and alternatives to beep: http://askubuntu.com/questions/19906...pt-not-working

DavidMcCann 02-11-2017 11:40 AM

Surely beep isn't a bash command?

You can play something from /usr/share/sounds using paplay, like
paplay /usr/share/sounds/freedesktop/stereo/bell.oga
paplay /usr/share/sounds/purple/alert.wav
paplay /usr/share/sounds/gnome/default/alerts/bark.ogg
or whatever you have there

hydrurga 02-11-2017 11:49 AM

Quote:

Originally Posted by DavidMcCann (Post 5668914)
Surely beep isn't a bash command?

You can play something from /usr/share/sounds using paplay, like
paplay /usr/share/sounds/freedesktop/stereo/bell.oga
paplay /usr/share/sounds/purple/alert.wav
paplay /usr/share/sounds/gnome/default/alerts/bark.ogg
or whatever you have there

Those would certainly sound nice than beep. :-)

Beep is in the Ubuntu archives. I assume it is also available for other systems.

JeremyBoden 02-11-2017 02:12 PM

Code:

~ $ beep
The program 'beep' is currently not installed.  To run 'beep' please ask your administrator to install the package 'beep'
beep: command not found
~ $ sudo apt-get install beep
man beep
beep - beep the [builtin] pc speaker any number of ways
...

Since beep wasn't pre-installed on a Debian system, it is likely that most distros won't include it. :D

ondoho 02-11-2017 03:50 PM

Quote:

Originally Posted by hack3rcon (Post 5668836)
Linux notify me.

you have to define this better.

if you want a desktop notification, like so many apps use, it has a command line ... erm, command:
Code:

wget URL && notify-send WGET "is finished!"

Doug G 02-11-2017 06:14 PM

beep is in the fedora repositories but doesn't seem to be in centos7 repositories.

r3sistance 02-11-2017 07:07 PM

&& echo -e '\07' or && echo -e '\a'

However this won't work over SSH, but I think you could use a >> to the relevant tty

JJJCR 02-12-2017 08:09 PM

Quote:

wget URL && run a script to send email for notification
you need to have a script though to notify via email

or if you have sms module in your system, send an SMS to your phone once it's done. :)


All times are GMT -5. The time now is 02:57 AM.