home *** CD-ROM | disk | FTP | other *** search
- #!/bin/sh
- # $Id: PsiBackup.sh,v 1.1 1997-04-05 18:39:43+02 jv Exp $
-
- ################ Config ################
-
- # NFS mount point for the Psion
- MNT=/mnt/psion/mnt
-
- # Name of the Psion (set to "" to disable).
- NAME=
-
- # Use JBStopGo to stop/restart applics on the Psion (set to 0 to disable).
- # The script will check the presence of opo/jbstopgo.opo before using it.
- STOPGO=1
-
- # Internal disk (where opo/jbstopgo.opo should reside).
- M=$MNT/loc::m:
-
- # Location of the Perl backup script.
- PRG=$HOME/psion/dumps/PsiBackup.pl
-
- # Where the dumps are located.
- DUMP=/dos/@psion
-
- ################ Check Config ################
-
- error=0
- if [ ! -f $PRG ]; then
- echo "Configuration error: PsiBackup program is missing!" >&2
- echo " PRG = $PRG" >&2
- error=1
- fi
- if [ ! -d $DUMP ]; then
- echo "Configuration error: Backup directory is missing!" >&2
- echo " DUMP = $DUMP" >&2
- error=1
- fi
- if [ ! -d $M ]; then
- echo "Configuration error: wrong mount directory or Psion not mounted!" >&2
- echo " MNT = $MNT" >&2
- error=1
- fi
- if [ ! $error = 0 ]; then
- echo "Backup aborted." >&2
- exit 1
- fi
-
- ################ End of Config ################
-
- # Check if we can use JBStopGo.
- if [ $STOPGO = 1 ]; then
- if [ -f $M/opo/jbstopgo.opo ]; then
- cat < /dev/null > $M/opd/jbsgl.ini
- rm -f $M/apopen.dat
- else
- STOPGO=0
- fi
- fi
-
- # Psion name, if set.
- if [ -n "$NAME" ]; then
- NAME="-name $NAME"
- fi
-
- # Stop the Psion applications.
- if [ $STOPGO = 1 ]; then
- echo 2>&1 "Stopping applications."
- ls "$M/opo/exec jbstopgo.opo" 2>&1 |
- grep -v 'jbstopgo.opo: No such device or address'
- sleep 10
- fi
-
- # Do the backup.
- echo 2>&1 "Starting backup."
- perl -w $PRG \
- -mount $MNT $NAME \
- -backup $DUMP ${1+"$@"}
-
- # Restart the Psion applications.
- if [ $STOPGO = 1 ]; then
- echo 2>&1 "Restarting applications."
- ls "$M/opo/exec jbstopgo.opo" 2>&1 |
- grep -v 'jbstopgo.opo: No such device or address'
- fi
-
- exit 0
-
-