Run only one instance of a program at a time
Lockfiles can provide race condition-free solutions
IRC is a great medium but chats are often intermittent and it's easy to miss messages if your focus is elsewhere. Lately I've been using Irssi which is extendible with Perl and I wrote a quick script to create a desktop popup alert any time my IRC username is mentioned in chat, or I receive a private message.
Warning, this script has a lot of dependencies. To use it, you'll need to be running GNOME 3, have Irssi and install Gtk3::Notify. There is an open issue on the Gtk3::Notify tests, so you'll have to force install it at the command line:
$ cpan -fi Gtk3::Notify
Gtk3::Notify has several C library dependencies, so you'll need to install those too - your Linux distro's package manager should have them.
Unless you're running any scripts with Irssi already, you'll need to create a scripts directory, and download gnotify.pl:
$ mkdir ~/.irssi/scripts $ cd ~/.irssi/scripts $ curl -O https://raw.githubusercontent.com/sillymoose/irssi/master/gnotify.pl
To have Irssi to autoload the script, create an "autorun" subdirectory with a symlink back to the script:
$ mkdir ~/.irssi/scripts/autorun $ cd ~/.irssi/scripts/autorun $ ln -s ../gnotify.pl
To make sure gnotify.pl is working, start Irssi and try sending a private message to yourself from within Irssi:
/msg username hey this is a test message
Just replace username with your own IRC username, for me it looks like this:
At the bottom of the screen you can see the popup alert.
Apart from desktop alerts, there are myriad ways to send IRC alerts: sounds, email and sms. A more sophisticated solution would be to write a script that uses a cloud-based notification service that could then transmit the alerts across all of these channels to the end user.
What types of IRC alerts do you use? Let us know on Reddit.