# Basic irc connect script



## Kitche (Jun 21, 2011)

I think I have the thought process incorrect in the following script can someone take a look at this please?

```
SERVICE=ii

if ps ax | grep -v grep | grep $SERVICE > /dev/null
then
echo "everything is fine"
else
while false; do
    ii -s irc.freenode.net -n kitche2 -k XXXXX -f "John Doe"
    iipid=$!
    sleep 5
    echo "/j ##freebsd" > ~/irc/irc.freenode.net/in
   echo "/j #infonomicon" > ~/irc/irc.freenode.net/in
   echo "/j #ubuntu" > ~/irc/irc.freenode.net/in
    
done

fi
```


----------



## SirDice (Jun 21, 2011)

On FreeBSD it's [cmd=]ps -ax[/cmd] not [cmd=]ps ax[/cmd]

And instead of using *ps -ax | grep -v grep | grep $SERVICE* use *pgrep $SERVICE*. See pgrep(1).


----------



## DutchDaemon (Jun 21, 2011)

*ps ax* works absolutely fine on FreeBSD ... always has, afaik. But yes, *pgrep* is preferred,


----------

