home *** CD-ROM | disk | FTP | other *** search
/ PDA Software Library / pdasoftwarelib.iso / PSION / 1997 / 982 / PSIBACKU.SH < prev    next >
Encoding:
Linux/UNIX/POSIX Shell Script  |  1997-04-05  |  1.9 KB  |  88 lines

  1. #!/bin/sh
  2. # $Id: PsiBackup.sh,v 1.1 1997-04-05 18:39:43+02 jv Exp $
  3.  
  4. ################ Config ################
  5.  
  6. # NFS mount point for the Psion
  7. MNT=/mnt/psion/mnt
  8.  
  9. # Name of the Psion (set to "" to disable).
  10. NAME=
  11.  
  12. # Use JBStopGo to stop/restart applics on the Psion (set to 0 to disable).
  13. # The script will check the presence of opo/jbstopgo.opo before using it.
  14. STOPGO=1
  15.  
  16. # Internal disk (where opo/jbstopgo.opo should reside).
  17. M=$MNT/loc::m:
  18.  
  19. # Location of the Perl backup script.
  20. PRG=$HOME/psion/dumps/PsiBackup.pl
  21.  
  22. # Where the dumps are located.
  23. DUMP=/dos/@psion
  24.  
  25. ################ Check Config ################
  26.  
  27. error=0
  28. if [ ! -f $PRG ]; then
  29.     echo "Configuration error: PsiBackup program is missing!" >&2
  30.     echo "    PRG = $PRG" >&2
  31.     error=1
  32. fi
  33. if [ ! -d $DUMP ]; then
  34.     echo "Configuration error: Backup directory is missing!" >&2
  35.     echo "    DUMP = $DUMP" >&2
  36.     error=1
  37. fi
  38. if [ ! -d $M ]; then
  39.     echo "Configuration error: wrong mount directory or Psion not mounted!" >&2
  40.     echo "    MNT = $MNT" >&2
  41.     error=1
  42. fi
  43. if [ ! $error = 0 ]; then
  44.     echo "Backup aborted." >&2
  45.     exit 1
  46. fi
  47.  
  48. ################ End of Config ################
  49.  
  50. # Check if we can use JBStopGo.
  51. if [ $STOPGO = 1 ]; then
  52.     if [ -f $M/opo/jbstopgo.opo ]; then
  53.         cat < /dev/null > $M/opd/jbsgl.ini
  54.         rm -f $M/apopen.dat
  55.     else
  56.     STOPGO=0
  57.     fi
  58. fi
  59.  
  60. # Psion name, if set.
  61. if [ -n "$NAME" ]; then
  62.     NAME="-name $NAME"
  63. fi
  64.  
  65. # Stop the Psion applications.
  66. if [ $STOPGO = 1 ]; then
  67.     echo 2>&1 "Stopping applications."
  68.     ls "$M/opo/exec jbstopgo.opo" 2>&1 |
  69.     grep -v 'jbstopgo.opo: No such device or address'
  70.     sleep 10
  71. fi
  72.  
  73. # Do the backup.
  74. echo 2>&1 "Starting backup."
  75. perl -w $PRG \
  76.     -mount $MNT $NAME \
  77.     -backup $DUMP ${1+"$@"}
  78.  
  79. # Restart the Psion applications.
  80. if [ $STOPGO = 1 ]; then
  81.     echo 2>&1 "Restarting applications."
  82.     ls "$M/opo/exec jbstopgo.opo" 2>&1 |
  83.     grep -v 'jbstopgo.opo: No such device or address'
  84. fi
  85.  
  86. exit 0
  87.  
  88.