Basic irc connect script

I think I have the thought process incorrect in the following script can someone take a look at this please?
Code:
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
 
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).
 
ps ax works absolutely fine on FreeBSD ... always has, afaik. But yes, pgrep is preferred,
 
Back
Top