Created
July 16, 2010 12:20
-
-
Save sukima/478301 to your computer and use it in GitHub Desktop.
Grab irssi notifications from a SSH server
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Retrieve irssi notifications from fnotify script via SSH. | |
# See full blog post at | |
# http://dev.tritarget.org/2010/07/16/irssi-notifications-over-ssh.html | |
SSH_CMD="ssh -p 22 [email protected]" | |
# Set this to what ever unique key generation you wish | |
RESET_KEY=`date | sha1sum | cut -d\ -f1` | |
##################################################################### | |
FIRST_RUN=yes | |
$SSH_CMD -n \ | |
"tail -n10 .irssi/fnotify ; echo 'reset $RESET_KEY' > .irssi/fnotify ; tail -f .irssi/fnotify" \ | |
| while read heading message; do | |
if [ "x$FIRST_RUN$heading" == "xyesreset" ]; then | |
if [ "x$message" == "x$RESET_KEY" ]; then | |
FIRST_RUN=no | |
fi | |
elif [ "x$FIRST_RUN$heading" == "xnoRequestURLBrowse" ]; then | |
open "$message" | |
else | |
growlnotify -n Irssi -a Terminal -m "$message" "$heading" | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment