Skip to content

Instantly share code, notes, and snippets.

@krl
Created December 10, 2011 18:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save krl/1455933 to your computer and use it in GitHub Desktop.
Save krl/1455933 to your computer and use it in GitHub Desktop.
iiconnect va
#!/bin/bash
PIDFILE=~/irc/$1/.meta/ii.pid
CONNECTFILE=~/irc/$1/.meta/on_connect
echo $PIDFILE
if [ ! -d ~/irc/$1/ ]; then
mkdir ~/irc/$1;
fi
if [ ! -d ~/irc/$1/.meta ]; then
mkdir ~/irc/$1/.meta;
fi
if [ ! -f $PIDFILE ]; then
echo "9999" > $PIDFILE;
fi
if ps $(cat $PIDFILE) > /dev/null; then
echo "$1 - already connected";
else
echo "$1 - connecting to";
ii -s $1 -n $2 -k $3 &
echo $! > $PIDFILE;
if [ -f $CONNECTFILE ]; then
echo "sleeping";
sleep 5s
echo "$1 - sending on_connect";
cat $CONNECTFILE > ~/irc/$1/in;
fi
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment