#!/bin/bash
declare -i BADCOUNT=0
while [ 1 -gt 0 ]
do
sleep 4
ps ax | grep away_chat | grep -v grep >> /dev/null 
if [ $? -ne 0 ] ; then
BADCOUNT=$BADCOUNT+1
else
BADCOUNT=0
fi

if [ $BADCOUNT -ge 4 ] ; then
	/usr/bin/centericq -p icq -S o
	/usr/bin/centericq -p yahoo -S o
	/usr/bin/centericq -p msn -S o
	/usr/bin/centericq -p aim -S o
	/usr/bin/centericq -p jab -S o
	exit 0
fi
done

