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 >
Wrap
Text File
|
2000-11-29
|
3KB
|
88 lines
#!/usr/bin/perl
#
# mkpushsiteconf: Generation du fichier /etc/pushsite.conf et
# programmation de la crontab pour la replication du site web public
# Version 1.1
#
# This script is part of the SLIS Project initiated by the CARMI-Internet
# (AcadΘmie de Grenoble - France 38).
# Ce script fait partie du projet SLIS dΘmarrΘ par le CARMI-Internet
# (AcadΘmie de Grenoble - France 38).
#
# SLIS : Serveur de communications Linux pour l'Internet Scolaire.
# Copyright (C) 2000 Bruno Bzeznik
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program (For example ./COPYING);
# if not, write to the Free Software Foundation, Inc., 675 Mass Ave,
# Cambridge, MA 02139, USA.
#
# Please send all comments and bug reports by electronic mail to:
# Bruno Bzeznik <Bruno@ac-grenoble.fr>
# or to <slis@ac-grenoble.fr>
#
# Envoyez vos suggestions et reports de bugs par e-mail α
# Bruno Bzeznik <Bruno@ac-grenoble.fr>
# ou α <slis@ac-grenoble.fr>
#
# Parametres
$conf="/etc/pushsite.conf";
$htdir="/home/httpd/html/public";
$crontab="/usr/bin/crontab";
$BINDIR="/usr/local/bin";
# Recuperation de variables SLIS
do '/home/hadmin/slis.conf.pl';
# Recuperation des variables SLIS pour pushsite
do "$BASE/pushsite.slis";
# Recuperation de l'email de l'administrateur
$admin=`grep \@ $BASE/params_admin.txt`;
chomp($admin);
$admin =~ s/\@/\\\@/;
# Ecriture du fichier de configuration pushsite
open(PC,">$conf");
print PC "\$dir = \"$htdir\"\;\n";
print PC "\#\$mailto = \"$admin\"\;\n";
print PC "\$logfile = \"/home/httpd/html/pushsite.html\"\;\n";
print PC "\$append=\"\"\;\n";
print PC "\$html=\"\"\;\n";
print PC "\$www = \"$server\"\;\n";
print PC "\$user = \"$user\"\;\n";
print PC "\$pass = \"$pass\"\;\n";
print PC "\$remotedir = \"$remotedir\"\;\n";
print PC "\$grace = \"300\"\;\n";
print PC "\$verbose = \"0\"\;\n";
print PC "\$ignorefilesizes = \"0\"\;\n";
print PC "\$chkfiles = \"(\\\\\\.htm|cgi|\\\\\\.pl|\\\\\\.php|\\\\\\.phtm|\\\\\\.html)\"\;\n";
print PC "chop(\$trapstr=lc(\`hostname -s\`))\;\n";
# Programmation de la crontab
`/bin/rm -rf /tmp/cron.*`;
$tmpext=rand();
`$crontab -l |grep -v "# DO NOT EDIT THIS FILE" | \
grep -v "installed on" | \
grep -v "(Cron version --" | \
grep -v "pushsite" > /tmp/cron.$tmpext`;
open (CRON,">>/tmp/cron.$tmpext");
if ($repli == 1) {
print CRON "# Replication du web public avec pushsite\n";
print CRON "$repli_m $repli_h * * * $SLIS_BINDIR/lance_pushsite\n";
}
print CRON "00 4 * * * $SLIS_BINDIR/pushsite_timeout\n";
close CRON;
`$crontab /tmp/cron.$tmpext`;