YAPS




Pilot-link/pppd Interface Scripts

Introduction

Prerequisite Software:

Scripts

These shell scripts are used to take the pppd link up and down to allow hotsync or dial up activity to occur. Most of these scripts are called by each other, so the only ones that intended to be executed directly are gsdbackup, to initiate a palm backup, gsdnetsync, for a networked HotSync, and startpppd, which is used to first bring the pppd link up (and thereafter to start it automatically on execution of one of the previous scripts)

startpppd

Startpppd attempts to kill any existing pppd then brings the linkup with the required options. This script is called both standalone (to bring the link up at boot time) and as part of the following scripts (to bring the link back up after any Palm operation. Note the baud rate of 56700
#!/bin/csh
#start the PPPD interface
#can't use persist as we won't be able to kill the interface!
/usr/local/pilot/bin/stoppppd
#This command should be on one line in the script
/usr/sbin/pppd /dev/pilot 56700 crtscts disconnect "/usr/local/pilot/bin/pppddown &" nodetach
local passive nedlnet:devastator proxyarp ms-dns 192.168.2.10 &

stoppppd

This will bring the link down without creating the hsactive flag file. Note that any attempt to bring the pppd linkd down without the hsactive flag present will cause the link to come backup in 5 seconds. This can be avoided by quickly killing the pppddown script after executing stoppppd .
#!/bin/csh
#stop the PPPD interface
kill -HUP `cat /var/run/ppp0.pid`

pppddown

pppddown executes when the pppd link is taken down by signal or Palm disconnection. It tests for the existance of a file and if true then the script exits, otherwise, the pppd link is brought back up again.
#!/bin/csh
#- e tests for existance of file, if fails then next cmd executed
sleep 5
# Commands and pipelines  can  also be joined into sequences 
# with `||' or `&&', indicating, as in the C language, that the second
# is to be executed only if the first fails or succeeds respectively.

[ -e /usr/local/pilot/bin/hsactive ] || /usr/local/pilot/bin/startpppd

ppplinkup

This script removes the hsactive file and brings the pppd link backup. The pppd commandline specifies the script to execute if the link is disconnected.
#!/bin/csh
#restart pppd
rm $PILROOT/hsactive
#This command should be on one line in the script
$PILROOT/startpppd

ppplinkdown

This script brings down the link in a friendly manner. It also creates the hsactive flag file to indicate that a hotsync operation is in operation. This means that when pppd tries to come back up again (because of the pppddown script) it finds the file and exits.
#!/bin/csh
#stop ppp
#create our file
touch $PILROOT/hsactive
#stop the PPPD interface
kill -HUP `cat /var/run/ppp0.pid`
setenv PILOTRATE 57600

gsdbackup

This script uses the previously defined linkup/down scripts to take the pppd link down and perform the actual pilot backup, into my home directory with a date based on the date the script is executed. The link is then brought back up.
#!/bin/csh
setenv PILROOT /usr/local/pilot/bin
setenv BACKUPDIR /usr/home/gsd/pilot/`date +%Y%m%d`

mkdir $BACKUPDIR

$PILROOT/ppplinkdown
$PILROOT/pilot-xfer -b $BACKUPDIR
$PILROOT/ppplinkup

gsdnetsync

The pilot-link toolset contains the application pi-nredir allowing network hotsyncs. i.e. the cradle is plugged into the freebsd box, but the windows `Palm Desktop` application controls the data transfer. This script does the neccessary to make it work with the pppd link.
#!/bin/csh
setenv PILROOT /usr/local/pilot/bin

$PILROOT/ppplinkdown
$PILROOT/pi-nredir /dev/pilot
$PILROOT/ppplinkup

Baud rates

The Palm can only seem to manage a connection of 19200 by default. Using LinkDirect allows it to connect right up to 56700bps. Using LinkDirect's incredibly simple GUI, if you start a connection at 56k, then disconnect. Future connections that are made automatically, like email with Handmail, or telnet with PTelnet, default to using the 56k connection.

Back to Top Page last modified: Thu Mar 1 19:08:23 GMT 2001