Sometimes is useful to put pop-up messages on running scripts, for example when running a back up or anything else, in order to get informed about the progress. The command discussed here is
notify-send
Display pop-up messages as ordinary user
Supposing that you have an script for make a back-up of your personal documents as
And you want to know when the backup has finished without checking the console.
All you have to do is adding a line such as
So the new script looks like
To see more options read the man page for notify-send.
#!/bin/bash
cp -r /home/user/documents /home/user/backups/
And you want to know when the backup has finished without checking the console.
All you have to do is adding a line such as
notify-send "BackUp Completed!" "Hi peasant, the back up process is done"
So the new script looks like
#!/bin/bash
cp -r /home/user/documents /home/user/backups/
notify-send "BackUp Completed!" "Hi peasant, the back up process is done"
Display pop-up messages as root
Supposing that you run the script as root and your wall username is user, yo can add this line to your script
export DISPLAY=:0.0 && sudo -u user notify-send "MsgTitle" "Message"
No hay comentarios.:
Publicar un comentario