home *** CD-ROM | disk | FTP | other *** search
/ ftp.parl.clemson.edu / 2015-02-07.ftp.parl.clemson.edu.tar / ftp.parl.clemson.edu / pub / pvfs2 / orangefs-2.8.3-20110323.tar.gz / orangefs-2.8.3-20110323.tar / orangefs / examples / heartbeat / pvfs2-ha-heartbeat-configure.sh < prev   
Linux/UNIX/POSIX Shell Script  |  2008-04-25  |  1KB  |  49 lines

  1. #!/bin/bash 
  2.  
  3. # make sure there are at least 2 arguments
  4. if [ -z "$3" ]
  5. then
  6.    echo "Usage: `basename $0` <dir to put conf files in> <mcast addr> <sha1 key> <space seperated list of nodes>"
  7.    exit 1
  8. fi
  9.  
  10. # save name of output dir
  11. OUTDIR=$1
  12. MCAST=$2
  13. SHA1=$3
  14.  
  15. # setup authkeys
  16. echo auth 1 > ${OUTDIR}/authkeys
  17. echo 1 sha1 $SHA1 >> ${OUTDIR}/authkeys
  18.  
  19. # set permissions on authkeys
  20. chmod 600 ${OUTDIR}/authkeys
  21. if [ $? != "0" ]
  22. then
  23.    exit 1
  24. fi
  25.  
  26. # put mcast information in the middle (ordering is important)
  27. echo "use_logd yes" > ${OUTDIR}/ha.cf
  28. echo "mcast eth0 ${MCAST} 3335 1 0" >> ${OUTDIR}/ha.cf
  29. echo "auto_failback yes" >> ${OUTDIR}/ha.cf
  30. echo "crm yes" >> ${OUTDIR}/ha.cf
  31. echo "keepalive 1" >> ${OUTDIR}/ha.cf
  32. echo "deadtime 10" >> ${OUTDIR}/ha.cf
  33. echo "initdead 80" >> ${OUTDIR}/ha.cf
  34. echo "compression bz2" >> ${OUTDIR}/ha.cf
  35.  
  36. # shift arguments down
  37. shift
  38. shift
  39. shift
  40.  
  41. until [ -z "$1" ]  # Until all parameters used up...
  42. do
  43.    # append node directive to conf file
  44.    echo "node $1" >> ${OUTDIR}/ha.cf
  45.    shift
  46. done
  47.  
  48. exit 0
  49.