The Haiku/BeOS Tip Server
Tips and tricks for Haiku/BeOS users

Get connected, stay connected, pt. I

Contributed by: Roman Filippov
This tip is valid for: Both BeOS and Haiku

If you have problems keeping your PPP connection alive, it may help to send out regularly spaced ping commands to keep communication between you and your ISP alive. Here’s an addition you can make to your ppp-script, as well as a small separate script that sends out ping commands whenever the connection is up.

Add to ~/config/etc/ppp-script:

——————–

if [ "$1" = "up" ]
then
touch /var/tmp/ppp_up

sits there

keep_alive &
date "+%D %T sess $3 started on $2 as $4" >> /var/log/online.log
MediaPlayer /boot/home/config/sounds/Startup Sounds/GoodVibesStart.aiff &
[ $( roster | grep "GimICQ2" | wc -l) -eq 0 ] && { Workspaces 3 ;
/boot/home/apps/GimICQ2/GimICQ_x86 & }
fi

if [ "$1" = "down" ]
then
if [ -f /var/tmp/ppp_up ]
then
touch /var/tmp/ppp_down
rm /var/tmp/ppp_up
date "+%D %T sess $3 closed" >> /var/log/online.log
MediaPlayer /boot/home/config/sounds/Startup Sounds/DarkStart.aiff &
else
if [ -f /var/tmp/ppp_down ]
then
rm /var/tmp/ppp_down
else
MediaPlayer /boot/home/config/sounds/System Beeps/BoingAlert2.aiff &
fi
fi
fi


Now create this script: /boot/home/config/bin/keep_alive (don't forget to chmod this to 755):

while [ -f /var/tmp/ppp_up ]
do
ping -c 1 -s 8 www.be.com
sleep 10
done

So these two pieces of code work in tandem to keep your connection humming along happily. You don’t need to launch any Terminal windows, press any Ctrl-C to quit, or anything else messy. Just connect and disconnect manually from the Deskbar replicant.

Posted in Scripting


(comments are closed).