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_rsync / slis_update-academie-3.2 < prev    next >
Text File  |  2012-12-03  |  3KB  |  115 lines

  1. #!/bin/bash
  2.  
  3. # slis_update-academie
  4.  
  5. # CUSTOMIZABLE UPDATE SCRIPT
  6.  
  7. # This script is part of the SLIS Project initiated by the CARMI-Internet
  8. # (AcadΘmie de Grenoble - France 38).
  9. # Ce script fait partie du projet SLIS dΘmarrΘ par le CARMI-Internet
  10. # (AcadΘmie de Grenoble - France 38).
  11. #
  12. # SLIS : Serveur de communications Linux pour l'Internet Scolaire.
  13. # Copyright (C) 1998-2000 Bruno Bzeznik
  14. #
  15. #    This program is free software; you can redistribute it and/or modify
  16. #    it under the terms of the GNU General Public License as published by
  17. #    the Free Software Foundation; either version 2 of the License, or
  18. #    (at your option) any later version.
  19. #
  20. #    This program is distributed in the hope that it will be useful,
  21. #    but WITHOUT ANY WARRANTY; without even the implied warranty of
  22. #    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  23. #    GNU General Public License for more details.
  24. #    You should have received a copy of the GNU General Public License
  25. #    along with this program (For example ./COPYING);
  26. #    if not, write to the Free Software Foundation, Inc., 675 Mass Ave,
  27. #    Cambridge, MA 02139, USA.
  28. #
  29. # Please send all comments and bug reports by electronic mail to:
  30. #   Bruno Bzeznik <Bruno@ac-grenoble.fr>
  31. # or to <slis@ac-grenoble.fr>
  32. #
  33. # Envoyez vos suggestions et reports de bugs par e-mail α
  34. #   Bruno Bzeznik <Bruno@ac-grenoble.fr>
  35. # ou α <slis@ac-grenoble.fr>
  36. #
  37.  
  38. ### VARIABLES ###
  39. UPDDIR=/home/hadmin/updates
  40. LOGTAG="slis_update[$$]"
  41. grep HOSTNAME /etc/sysconfig/network > /tmp/hostname
  42. . /tmp/hostname
  43. rm -rf /tmp/hostname
  44. WEBMASTER=`ls -ld /home/httpd/html |awk '{print $3}'`
  45. . /home/hadmin/slis.conf 2>/dev/null
  46. . /usr/local/lib/slis-sys.inc.bash
  47. load_config
  48.  
  49.  
  50.  
  51. # PUT HERE THE VARIABLES YOU NEED
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58. ##################
  59.  
  60. # Locking
  61. if [ -e /var/lock/slis_upd ]
  62. then
  63.   logger -t "$LOGTAG" "Lock found. Update already started."
  64.   exit
  65. fi
  66. touch /var/lock/slis_upd
  67. sleep 1
  68.  
  69. logger -t "$LOGTAG" "Script Academy 3.2 started."
  70.  
  71. ##################
  72.  
  73.  
  74.  
  75.  
  76. # PUT HERE YOUR PERSONNAL UPDATES
  77.  
  78.  
  79.  
  80.  
  81.  
  82.  
  83. # Change update server
  84. if [ ! \( -e $UPDDIR/update_server \) ]
  85. then
  86.   sed -i "s/RSYNC_HOST=[\"']193.54.149.12[\"']/RSYNC_HOST=\"193.54.149.22\"/" /etc/slis/slis.conf
  87.   if [ $? != 0 ] 
  88.   then
  89.     logger -t "$LOGTAG" "Changing update server - ERROR: sed failed!"
  90.     FAILURE=1
  91.   else
  92.     sed -i 's;ftp://ftp.ac-grenoble.fr/pub/slis;ftp://old.slis.fr/;' /etc/apt/sources.list
  93.     if [ $? != 0 ] 
  94.     then
  95.       logger -t "$LOGTAG" "Changing update server - ERROR: sed failed!"
  96.       FAILURE=1
  97.     else
  98.       touch $UPDDIR/update_server
  99.     fi  
  100.   fi  
  101. fi
  102.  
  103.  
  104.  
  105.  
  106.  
  107.  
  108. ######################
  109.  
  110.  
  111. ##############################
  112. logger -t "$LOGTAG" "Script Academy 3.2 ended."
  113.  
  114. /bin/rm -rf /var/lock/slis_upd
  115.