Created
December 10, 2011 18:50
-
-
Save krl/1455933 to your computer and use it in GitHub Desktop.
iiconnect va
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/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