Tech Tip: Get Notifications from Your Scripts with notify-send
Notify-send is a great application for notifying you when an event has occurred. An event such as a script running to completion.
If notify-send is not installed on your machine already, install the package "libnotify1" (or possibly just "libnotify") from your repositories.
Once installed you can simply type the following, at the command line, to display a pop-up message near your system tray:
By default the message will be displayed for 5 seconds. To change how long a message stays displayed use the "-t" switch. This will change, in milliseconds, how long the message is displayed. Enter "-t 0" to leave the message up until the user closes it.
notify-send "This message will be displayed for 3 seconds" -t 3000 notify-send "Click me to close me." -t 0
You can even add a title and an icon to the notification.
notify-send "This is the Title" \ "Check out the cool icon" \ -i /usr/share/pixmaps/gnome-terminal.png
When used in a script you could set it to notify you periodically by placing the command in a loop:
#!/bin/bash while [ 1 ]; do notify-send "Up Time" "`uptime`" sleep 5m done
Fast/Flexible Linux OS Recovery
On Demand Now
In this live one-hour webinar, learn how to enhance your existing backup strategies for complete disaster recovery preparedness using Storix System Backup Administrator (SBAdmin), a highly flexible full-system recovery solution for UNIX and Linux systems.
Join Linux Journal's Shawn Powers and David Huffman, President/CEO, Storix, Inc.
Free to Linux Journal readers.Register Now!
- Firefox 46.0 Released
- Ubuntu Online Summit
- Devuan Beta Release
- The Qt Company's Qt Start-Up
- May 2016 Issue of Linux Journal
- The US Government and Open-Source Software
- The Death of RoboVM
- Open-Source Project Secretly Funded by CIA
- Download "Linux Management with Red Hat Satellite: Measuring Business Impact and ROI"
- New Container Image Standard Promises More Portable Apps
In modern computer systems, privacy and security are mandatory. However, connections from the outside over public networks automatically imply risks. One easily available solution to avoid eavesdroppers’ attempts is SSH. But, its wide adoption during the past 21 years has made it a target for attackers, so hardening your system properly is a must.
Additionally, in highly regulated markets, you must comply with specific operational requirements, proving that you conform to standards and even that you have included new mandatory authentication methods, such as two-factor authentication. In this ebook, I discuss SSH and how to configure and manage it to guarantee that your network is safe, your data is secure and that you comply with relevant regulations.Get the Guide