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 / mkpushsiteconf < prev    next >
Text File  |  2000-11-29  |  3KB  |  88 lines

  1. #!/usr/bin/perl
  2. #
  3. # mkpushsiteconf: Generation du fichier /etc/pushsite.conf et 
  4. # programmation de la crontab pour la replication du site web public
  5. # Version 1.1
  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) 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. # Parametres
  39. $conf="/etc/pushsite.conf";
  40. $htdir="/home/httpd/html/public";
  41. $crontab="/usr/bin/crontab";
  42. $BINDIR="/usr/local/bin";
  43.  
  44. # Recuperation de variables SLIS
  45. do '/home/hadmin/slis.conf.pl';
  46.  
  47. # Recuperation des variables SLIS pour pushsite
  48. do "$BASE/pushsite.slis";
  49.  
  50. # Recuperation de l'email de l'administrateur
  51. $admin=`grep \@ $BASE/params_admin.txt`;
  52. chomp($admin);
  53. $admin =~ s/\@/\\\@/;
  54.  
  55. # Ecriture du fichier de configuration pushsite
  56. open(PC,">$conf");
  57. print PC "\$dir = \"$htdir\"\;\n";
  58. print PC "\#\$mailto = \"$admin\"\;\n";
  59. print PC "\$logfile = \"/home/httpd/html/pushsite.html\"\;\n";
  60. print PC "\$append=\"\"\;\n";
  61. print PC "\$html=\"\"\;\n";
  62. print PC "\$www = \"$server\"\;\n";
  63. print PC "\$user = \"$user\"\;\n";
  64. print PC "\$pass = \"$pass\"\;\n";
  65. print PC "\$remotedir = \"$remotedir\"\;\n";
  66. print PC "\$grace = \"300\"\;\n";
  67. print PC "\$verbose = \"0\"\;\n";
  68. print PC "\$ignorefilesizes = \"0\"\;\n";
  69. print PC "\$chkfiles = \"(\\\\\\.htm|cgi|\\\\\\.pl|\\\\\\.php|\\\\\\.phtm|\\\\\\.html)\"\;\n";
  70. print PC "chop(\$trapstr=lc(\`hostname -s\`))\;\n";
  71.  
  72. # Programmation de la crontab
  73. `/bin/rm -rf /tmp/cron.*`;
  74. $tmpext=rand();
  75. `$crontab -l |grep -v "# DO NOT EDIT THIS FILE" | \
  76.     grep -v "installed on" | \
  77.     grep -v "(Cron version --" | \
  78.     grep -v "pushsite" > /tmp/cron.$tmpext`;
  79. open (CRON,">>/tmp/cron.$tmpext");
  80. if ($repli == 1) {
  81.   print CRON "# Replication du web public avec pushsite\n";
  82.   print CRON "$repli_m $repli_h * * *    $SLIS_BINDIR/lance_pushsite\n";
  83. }
  84. print CRON "00 4 * * *    $SLIS_BINDIR/pushsite_timeout\n";
  85. close CRON;
  86. `$crontab /tmp/cron.$tmpext`;
  87.  
  88.