The advantage of running irssi (command-line IRC client) in a persistent screen session on a box you can SSH to is twofold: 1) You get logs of all channel and PM activity, 24/7 except Christmas. (Just kidding, Christmas too!) 2) You can tunnel in from any computer with an internet connection that may not have an IRC client installed.
On OSX there’s Growl, which issues desktop notifications. I find it sort of useless to be on IRC and have no audible notification of incoming messages and mentions. There’s a page with a great explanation for how to set up notification over the tunnel to the box with the irssi session. Here’s the page I’m referring to.
Something that is left as a hanging question is how to automatically start a requisite shell script on startup without it leaving an annoying otherwise useless terminal window open. The comments section on that page seems to be closed or broken, so I’m explaining my fix to this problem here.
Just to make this self-contained and in case the other page goes the way of its comments section, following are simply the steps outlined in that page I mentioned. I assume you have a remote VM that runs persistently and that irssi is installed on. Personally, for this purpose I use a $5/mo. “droplet” through DigitalOcean.
- Log in to the remote VM and add the fnotify script to your ~/.irssi/scripts/ directory. Or put it in ~/.irssi/scripts/autorun to have it load automatically when you start irssi.
(in a remote terminal)
$ wget http://bit.ly/fnotify-raw -O ~/.irssi/scripts/autorun
- To get fnotify.pl loaded in a pre-existing irssi session, enter this command in irssi:
/script load autorun/fnotify.pl
- Confirm it’s working by PM-ing yourself while tailing the fnotify file:
(in one remote terminal)
$ tail -f ~/.irssi/fnotify
(in irssi in another remote terminal)
/q <your username>
(also in irssi)
test foo bar
- On your local machine, install Growl and GrowlNotify. Test the latter:
(in a local terminal)
$ growlnotify -m 'whatever'
- Subbing in your username and hostname, save the following in a script as, say, ~/irrsi_growler (modified slightly from the original):
(ssh ssh_username@your_server.com -o PermitLocalCommand=no \
": > .irssi/fnotify ; tail -f .irssi/fnotify "
Now, for the start-on-login issue, my workaround is to name the remote screen session something consistent (e.g. “irssi”) which can be done _in_ the remote screen session by ctrl-a followed by
:sessionname <sessionname> and then open irssi (through a tunnel) with a bash function defined in my .bashrc:
[[ -z $(ps aux | grep -v grep | grep irssi_growler) ]] && irssi_growler
ssh -t <username>@<hostname> screen -r <screenname>
It only starts irssi_growler if it’s not already running.
Make sure you make irssi_growler executable:
$ chmod +x ~/irssi_growler
A mystery: For some reason this makes _2_ processes for irssi_growler. Dunno why, but the point is that the number of irssi_growler processes does not grow as you close and reopen the connection and session.
I’m confident that there are simple ways to improve upon my approach to the start-on-login issue that I’m unaware of if not a better solution entirely. Happy for any input.