home *** CD-ROM | disk | FTP | other *** search
/ ftp.ac-grenoble.fr / 2015.02.ftp.ac-grenoble.fr.tar / ftp.ac-grenoble.fr / pub / slis / updates_4.0_rsync / slis_update-common-pre < prev    next >
Text File  |  2007-06-05  |  3KB  |  104 lines

  1. #!/bin/bash
  2. # This script is part of the SLIS Project initiated by the CARMI-Internet
  3. # (AcadΘmie de Grenoble - France 38).
  4. # Ce script fait partie du projet SLIS dΘmarrΘ par le CARMI-Internet
  5. # (AcadΘmie de Grenoble - France 38).
  6. #
  7. # SLIS : Serveur de communications Linux pour l'Internet Scolaire.
  8. # Copyright (C) 1998-2003 Bruno Bzeznik
  9. #
  10. #    This program is free software; you can redistribute it and/or modify
  11. #    it under the terms of the GNU General Public License as published by
  12. #    the Free Software Foundation; either version 2 of the License, or
  13. #    (at your option) any later version.
  14. #
  15. #    This program is distributed in the hope that it will be useful,
  16. #    but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. #    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  18. #    GNU General Public License for more details.
  19. #    You should have received a copy of the GNU General Public License
  20. #    along with this program (For example ./COPYING);
  21. #    if not, write to the Free Software Foundation, Inc., 675 Mass Ave,
  22. #    Cambridge, MA 02139, USA.
  23. #
  24. # Please send all comments and bug reports by electronic mail to:
  25. #   Bruno Bzeznik <Bruno@ac-grenoble.fr>
  26. # or to <slis@ac-grenoble.fr>
  27. #
  28. # Envoyez vos suggestions et reports de bugs par e-mail α
  29. #   Bruno Bzeznik <Bruno@ac-grenoble.fr>
  30. # ou α <slis@ac-grenoble.fr>
  31. #
  32. # Contact: Olivier.LeCam@crdp.ac-versailles.fr
  33. #
  34. # Comments:
  35. # Downloaded via rsync and executed by SLIS during
  36. # the 'slis_update' process
  37. # Started before version updates
  38. #
  39. # Updates:
  40. # olecam: Jan 9, 2006: script ported to SLIS v4
  41.  
  42. #
  43. # Variables
  44. #
  45. LOGTAG="slis_update-common-pre[$$]"
  46. VERSION=`cat /etc/version_slis_num`
  47. SLIS_LIB="/usr/sbin/slis-sys.inc.bash"
  48. LOCKFILE="/var/lock/slis/slis_update-common-pre"
  49. SCRIPT_STATUS_MSG="Script 'slis_update-common-pre'"
  50.  
  51. . $SLIS_LIB 2>/dev/null
  52. load_config 2>/dev/null
  53.  
  54. #
  55. # Locking
  56. #
  57. if [ -e $LOCKFILE ]
  58. then
  59.       logger -t "$LOGTAG" "Lock found. Update already started."
  60.       exit
  61. fi
  62. touch $LOCKFILE
  63. sleep 1
  64.  
  65. logger -t "$LOGTAG" "$SCRIPT_STATUS_MSG: started."
  66. ##############################
  67.  
  68. ############################################################################
  69. ### Update SONDAGE1 - 14/02/2006
  70. # Register the SLIS to http://www.slis.fr/sondage/register.php
  71. # just to count the total number of installed SLIS
  72. # This registering is only opened for this month. It will be disabled
  73. # as soon as the total number is stabilized. Then, we'll be able to publish
  74. # "As February 2006, there'are *N* SLIS up2date worldwild!" 
  75. ############################################################################
  76.  
  77. UPDDIR="/tmp"
  78.  
  79. if [ ! \( -e $UPDDIR/SONDAGE1 \) ]
  80. then
  81.  
  82.   HOST=`hostname -s`
  83.   DOMAIN=`hostname -d`
  84.   VERSION=`cat /etc/version_slis_num`
  85.   wget -t 1 -T 20 -q -O /tmp/sondage "http://www.slis.fr/sondage/register.php?action=register&host=$HOST&domain=$DOMAIN&version=$VERSION"
  86.   RC=$?
  87.  
  88.   if [ $RC = 0 ]
  89.   then
  90.     if [ "`egrep "Bad|ERROR" /tmp/sondage`" != "" ]
  91.     then
  92.        wget -q -O /dev/null "http://www.slis.fr/sondage/register.php?action=error"
  93.     fi
  94.     touch $UPDDIR/SONDAGE1
  95.     logger -t "$LOGTAG" "Update SONDAGE1 done."
  96.   fi
  97. fi
  98. ###
  99.  
  100. ##############################
  101. logger -t "$LOGTAG" "$SCRIPT_STATUS_MSG: successed."
  102.  
  103. rm -f $LOCKFILE
  104.