« TESTS DIVERS V2 » : différence entre les versions
Aucun résumé des modifications |
Aucun résumé des modifications |
||
| (12 versions intermédiaires par le même utilisateur non affichées) | |||
| Ligne 1 : | Ligne 1 : | ||
[[Category:TEST]] | |||
[[PCStreet:EssaiEspaceDeNomsPCStreet]] | |||
essai d'espace de noms dans cet espace de noms: "{{NAMESPACE}}" {{ns:PCStreet}} - . | |||
banzayonnaise2 (juste pour pouvoir tester sphinxsearch et consort). | |||
Création d'une page à la con pour pouvoir faire des tests: | |||
PDF: | |||
--------------------------------------------------------------------------------------- | |||
extension SimpleEmbed <nowiki>(<embed width= height>)></nowiki> : (pdf,jpg,png ...) | |||
<embed width=800 height=600> http://localhost/mediawiki/images/X.pdf</embed> | |||
<embed>http://localhost/mediawiki/images/X.png</embed>< | |||
--------------------------------------------------------------------------------------- | |||
'extension ''PDFInclude''' (pdf,jpg,png ...) | |||
<pdf width=135 height=135>http://localhost/mediawiki/images/PCStreet.logo.135x135.jpg</pdf> | |||
.pcmakeUpdatePcWikiFromPc231: | |||
<nowiki> | |||
#!/bin/bash | |||
# mercredi 2 mai 2018, 18:23:02 (UTC+0200) | |||
# en cours: lundi 7 mai 2018, 15:12:43 (UTC+0200) | |||
# CpuPcstretien::/root/PCStreet.scripts/.pcmakeUpdatePcWiki2FromPc231 | |||
# ============================================================================== | |||
# COMMENT: | |||
# Ce script sert à importer un pcwiki à partir de pc231.pcstreet.org sur un système local PCStreetien | |||
# en gardant les includes.[ip|md5].protection.conf et htdigest par mesure de pcrécaution | |||
# ============================================================================== | |||
# GLOBALS: | |||
__strScriptName=".pcmakeUpdatePcWiki2.fromPc231" | |||
__strVersion="V2.03 du 07/05/2018" | |||
__strDateStamp="`date '+%Y%m%d'`" | |||
__strFullDateStamp="`date '+%Y%m%d-%H%M%S'`" | |||
# Définition du site qui accueille à partir d'avril 2018, c'est pc231): | |||
__strServerNameFrom="pc231" | |||
# __boolFlagFirstTime=1 # (Uniquement la 1° fois (maj de php,apache,phpmyadmin ..) | |||
__boolFlagFirstTime=0 | |||
# ============================================================================== | |||
# IMPORTED FUNCTIONS: | |||
source /root/source.functions.PC/fnStrings.sh | |||
intRet=${?} | |||
if test ${intRet} -ne 0 | |||
then | |||
echo "Impossible de charger le source '/root/source.functions.PC/fnStrings.sh'" | |||
exit 233 | |||
fi | |||
# FONCTIONS & VARIABLES GLOBALES DISPONIBLES: | |||
# __strRenameStringInLine= | |||
# fnRenameStringInLine() | |||
# __strRenameStringInFile= | |||
# fnRenameStringInFile() | |||
source /root/source.functions.PC/fnTrace.sh | |||
intRet=${?} | |||
if test ${intRet} -ne 0 | |||
then | |||
echo "Impossible de charger le source '/root/source.functions.PC/fnTrace.sh'" | |||
exit 233 | |||
fi | |||
# FONCTIONS & VARIABLES GLOBALES DISPONIBLES: | |||
# fn_traceIN() | |||
# fn_traceOUT() | |||
# ============================================================================== | |||
# FUNCTIONS: | |||
fn_stopMysql() | |||
{ | |||
fn_traceIN "fn_stopMysql()" | |||
service mysql stop | |||
killall mysqld | |||
ps awwwxx|grep mysqld|grep -v grep | |||
intRet=$? | |||
if test ${intRet} -eq 0 | |||
then | |||
echo "impossible d'arrêter mysql" | |||
fi | |||
fn_traceOUT "fn_stopMysql()" | |||
} | |||
fn_startMysql() | |||
{ | |||
fn_traceIN "fn_startMysql()" | |||
service mysql start | |||
ps awwwxx|grep mysqld|grep -v grep | |||
intRet=$? | |||
if test ${intRet} -ne 0 | |||
then | |||
echo "impossible de relancer mysql" | |||
exit 234 | |||
fi | |||
fn_traceOUT "fn_startMysql()" | |||
} | |||
fn_restartMysql() | |||
{ | |||
fn_traceIN "fn_restartMysql()" | |||
service mysql restart | |||
fn_traceOUT "fn_restartMysql()" | |||
} | |||
fn_restartApache2() | |||
{ | |||
fn_traceIN "fn_restartApache2()" | |||
if test ${__boolFlagFirstTime} -eq 1 # Uniquement la 1° fois (maj de php,apache,phpmyadmin ..) | |||
then | |||
sh /etc/init.d/apache2 force-reload | |||
# Super pour débugger: | |||
apache2ctl -t | |||
apache2ctl -S | |||
fi | |||
fn_traceOUT "fn_restartApache2()" | |||
} | |||
function fnConstructor() | |||
{ | |||
fn_traceIN "fnConstructor()" | |||
touch ${0} | |||
cd /var/lib/mediawiki | |||
if test $? -ne 0 | |||
then | |||
mkdir -p /var/lib/mediawiki | |||
fi | |||
if test ${__boolFlagFirstTime} -eq 1 | |||
then | |||
sh /root/PCStreet.scripts.pcmakeInstallByHandMediawiki | |||
apt-get install -y sphinxsearch | |||
fi | |||
fn_stopMysql | |||
fn_startMysql | |||
fn_traceOUT "fnConstructor()" | |||
} | |||
function fnDestructor() | |||
{ | |||
fn_traceIN "fnDestructor()" | |||
echo -n "" | |||
ps awx|grep searchd|grep -v grep | |||
ps awx|grep apache2|grep -v grep | |||
ps awx|grep mysql|grep -v grep | |||
fn_traceOUT "fnDestructor()" | |||
} | |||
fn_getLastRelease() | |||
{ | |||
fn_traceIN "fn_getLastRelease()" | |||
wget releases.wikimedia.org/mediawiki/1.30/mediawiki-1.30.0.tar.gz | |||
fn_traceOUT "fn_getLastRelease()" | |||
} | |||
fn_recupImages() | |||
{ | |||
# Phase I: récuperation des images à partir de $__strServerNameFrom: | |||
fn_traceIN "fn_recupImages()" | |||
rsync -avzlH --port=874 --partial --fuzzy $__strServerNameFrom::RaCiNe/var/lib/mediawiki/images /var/lib/mediawiki/ --exclude 'LocalSettings.php' | |||
fn_traceOUT "fn_recupImages()" | |||
} | |||
fn_recupData() | |||
{ | |||
# Phase II: récuperation du dernier dump de la base sur $__strServerNameFrom: | |||
fn_traceIN "fn_recupData()" | |||
rsync -avzlH --port=874 --partial --fuzzy $__strServerNameFrom::RaCiNe/var/lib/mediawiki/.sauvegardes /var/lib/mediawiki/ --exclude "*.xml*" --exclude 'LocalSettings.php' | |||
fn_traceOUT "fn_recupData()" | |||
} | |||
fn_recupRoot() | |||
{ | |||
# Phase III: récuperation du corps même des programmes: | |||
fn_traceIN "fn_recupRoot()" | |||
rsync -avzlH --port=874 --partial --fuzzy $__strServerNameFrom::RaCiNe/var/lib/mediawiki/ /var/lib/mediawiki/ --exclude "*.xml*" --exclude '*gz' --exclude '.sauvegardes.' --exclude 'LocalSettings.php' | |||
rsync -avzlH --port=874 --partial --fuzzy $__strServerNameFrom::RaCiNe/etc/mediawiki /etc --exclude 'LocalSettings.php' --exclude 'apache.conf' | |||
fn_traceOUT "fn_recupRoot()" | |||
} | |||
fn_dropMysql() | |||
{ | |||
# Indispensable de détruire le contenu du répertoire avant de descendre la base: | |||
fn_traceIN "fn_dropMysql()" | |||
ps awx|grep mysql | |||
echo "" | |||
echo "Ne répondez pas à la question, cela va se faire tout seul" | |||
mysqladmin -u root --password=fr...ce drop wiki_pcwiki2 << EoF | |||
y | |||
EoF | |||
rm -f /var/lib/mysql/wiki_pcwiki2/* >/dev/null 2>&1 | |||
fn_stopMysql | |||
fn_startMysql | |||
fn_traceOUT "fn_dropMysql()" | |||
} | |||
fn_createMysql() | |||
{ | |||
fn_traceIN "fn_createMysql()" | |||
mysqladmin -u root --password=fr...ce create wiki_pcwiki2 | |||
mysql -u root --password=fr...ce << EoF | |||
USE wiki_pcwiki2; | |||
GRANT SELECT, UPDATE, INSERT, DELETE, USAGE ON wiki_pcwiki2.* TO pchevalier; | |||
GRANT SELECT, UPDATE, INSERT, DELETE, USAGE ON wiki_pcwiki2.* TO root; | |||
GRANT SELECT, UPDATE, INSERT, DELETE, USAGE ON wiki_pcwiki2.* TO admin; | |||
GRANT SELECT, UPDATE, INSERT, DELETE, USAGE ON wiki_pcwiki2.* TO phpmyadmin; | |||
EoF | |||
fn_traceOUT "fn_createMysql()" | |||
} | |||
fn_insertIntoMysql() | |||
{ | |||
fn_traceIN "fn_insertMysql()" | |||
gunzip -f /var/lib/mediawiki/.sauvegardes/wiki_pcwiki-last.sql.gz | |||
mysql -u root --password=fr...ce wiki_pcwiki2 < /var/lib/mediawiki/.sauvegardes/wiki_pcwiki-last.sql | |||
gzip -f /var/lib/mediawiki/.sauvegardes/wiki_pcwiki-last.sql | |||
fn_traceOUT "fn_insertMysql()" | |||
} | |||
fn_updateData() | |||
{ | |||
fn_traceIN "fn_updateData()" | |||
# Mise à jour de la base de données: | |||
php maintenance/update.php --quick | |||
fn_traceOUT "fn_updateData()" | |||
} | |||
fnImportAndChangeFilesForMediawiki() | |||
{ | |||
fn_traceIN "fnImportAndChangeFilesForMediawiki()" | |||
# Phase I: recopie de pc231::/etc/mediawiki/apache.conf | |||
mkdir -p /etc/mediawiki 2>/dev/null | |||
cd /etc/mediawiki | |||
if test $? -eq 0 | |||
then | |||
# Récuperation du fichier de conf 'pc231::/etc/mediawiki/apache.conf': | |||
RSYNC_PASSWORD=billou rsync \ | |||
-avlH \ | |||
--exclude '*.bak' \ | |||
--port=874 \ | |||
root@${__strServerNameFrom}::RaCiNe/etc/mediawiki/apache.conf /etc/mediawiki/ | |||
fnRenameStringInFile /etc/mediawiki/apache.conf ${__strServerNameFrom} debian9.vm | |||
# Récuperation du fichier de conf 'pc231:/etc/apache2/sites-available/pcwiki.pc231.debian9.vm.pcstreet.org.conf*': | |||
RSYNC_PASSWORD=billou rsync \ | |||
-avlH \ | |||
--exclude '*.bak' \ | |||
--port=874 \ | |||
root@${__strServerNameFrom}::RaCiNe/etc/apache2/sites-available/pcwiki.${__strServerNameFrom}.pcstreet.org.conf /etc/apache2/sites-available/ | |||
# Récuperation des fichiers de conf 'pc231:/etc/apache2/include.[ip,md5].protection.conf': | |||
RSYNC_PASSWORD=billou rsync \ | |||
-avlH \ | |||
--port=874 \ | |||
--exclude '*.bak' \ | |||
root@${__strServerNameFrom}::RaCiNe/etc/apache2/include.*.protection.conf /etc/apache2 | |||
# cat /etc/apache2/include.ip.protection.conf |grep 192 | |||
fnRenameStringInFile /etc/apache2/include.ip.protection.conf "192.168.1.0\/24" "192.168.0.0\/16" | |||
# echo "================================================" | |||
# cat /etc/apache2/include.ip.protection.conf |grep 192 | |||
# Récuperation du fichier des mots de passe htdigest | |||
RSYNC_PASSWORD=billou rsync \ | |||
-avlH \ | |||
--port=874 \ | |||
--exclude '*.bak' \ | |||
root@${__strServerNameFrom}::RaCiNe/etc/apache2/htdigest /etc/apache2 | |||
echo ${strToChange} | |||
fnRenameStringInFile /etc/mediawiki/apache.conf "{strToChange}" "\#" | |||
fnRenameStringInFile /etc/mediawiki/LocalSettings.php ${__strServerNameFrom} debian9.vm | |||
# Récuperation du fichier de conf 'pc231:/etc/mediawiki/LocalSettings.php': | |||
RSYNC_PASSWORD=billou rsync \ | |||
-avlH \ | |||
--port=874 \ | |||
root@${__strServerNameFrom}::RaCiNe/etc/mediawiki/LocalSettings* /etc/mediawiki/ | |||
# Récuperation du fichier de conf 'pc231:/etc/mediawiki/LocalSettings.php': | |||
RSYNC_PASSWORD=billou rsync \ | |||
-avlH \ | |||
--delete \ | |||
--port=874 \ | |||
--exclude "LocalSettings.php" \ | |||
root@${__strServerNameFrom}::RaCiNe/var/lib/mediawiki /var/lib/ | |||
rm -f /var/lib/mediawiki/LocalSettings.php 2>/dev/null | |||
ln -s /etc/mediawiki/LocalSettings.php /var/lib/mediawiki | |||
rm -f /var/www/mediawiki 2>/dev/null | |||
rm -f /var/www/html/mediawiki 2>/dev/null | |||
ln -s /var/lib/mediawiki /var/www/html/mediawiki | |||
fnRenameStringInFile /etc/mediawiki/apache.conf ${__strServerNameFrom} debian9.vm | |||
fnRenameStringInFile /etc/mediawiki/LocalSettings.php ${__strServerNameFrom} debian9.vm | |||
fi | |||
fn_traceOUT "fnImportAndChangeFilesForMediawiki()" | |||
} | |||
fnChangeFilesForApache2() | |||
{ | |||
fn_traceIN "fnChangeFilesForApache2()" | |||
# Phase II: installation des fichiers de conf apache (liés à /etc/mediawiki/apache.conf) | |||
cd /etc/apache2 | |||
if test $? -eq 0 | |||
then | |||
# Récuperation du fichier de conf 'pc231:/etc/apache2/sites-available/pcwiki.pc231.pcstreet.org.conf:' | |||
rm -f /etc/apache2/sites-available/pcwiki.${__strServerNameFrom}.pcstreet.org.conf 2>/dev/null | |||
rm -f /etc/apache2/sites-enabled/pcwiki.${__strServerNameFrom}.pcstreet.org.conf 2>/dev/null | |||
rm -f /etc/apache2/sites-available/pcwiki.debian9.vm.pcstreet.org.conf 2>/dev/null | |||
rm -f /etc/apache2/sites-enabled/pcwiki.debian9.vm.pcstreet.org.conf 2>/dev/null | |||
ln -s /etc/mediawiki/apache.conf /etc/apache2/sites-available/pcwiki.debian9.vm.pcstreet.org.conf | |||
ln -s /etc/apache2/sites-available/pcwiki.debian9.vm.pcstreet.org.conf /etc/apache2/sites-enabled/pcwiki.debian9.vm.pcstreet.org.conf | |||
fi | |||
service apache2 stop | |||
killall apache2 2>/dev/null | |||
service apache2 start | |||
fn_traceOUT "fnChangeFilesForApache2()" | |||
} | |||
fnImportAndChangeFilesForSphinxSearch() | |||
{ | |||
fn_traceIN "fnImportAndChangeFilesForSphinxSearch()" | |||
# Phase III: recopie de pc231:/etc/sphinxsearch/sphinx.conf | |||
mkdir -p /etc/sphinxsearch 2>/dev/null | |||
cd /etc/sphinxsearch | |||
if test $? -eq 0 | |||
then | |||
# Récuperation du fichier de conf 'pc231:/etc/sphinxsearch/sphinx.conf': | |||
RSYNC_PASSWORD=billou rsync \ | |||
-avlH \ | |||
--port=874 \ | |||
root@${__strServerNameFrom}::RaCiNe/etc/sphinxsearch/sphinx.conf /etc/sphinxsearch | |||
fnRenameStringInFile /etc/sphinxsearch/sphinx.conf ".1.231:" ".122.211:" | |||
fnRenameStringInFile /etc/default/sphinxsearch "START=no" "START=yes" | |||
fi | |||
service sphinxsearch stop | |||
killall sphinxsearch 2>/dev/null | |||
service sphinxsearch start | |||
fn_traceOUT "fnImportAndChangeFilesForSphinxSearch()" | |||
} | |||
# Indispensable car sinon, les liens trouvés vont renvoyer vers pc231: | |||
fn_reIndexe() | |||
{ | |||
fn_traceIN "fn_reIndexe()" | |||
/bin/bash /root/PCStreet.scripts/.pcmakeSphinxIndexer | |||
fn_traceOUT "fn_reIndexe()" | |||
} | |||
fn_restartSphinx() | |||
{ | |||
fn_traceIN "fn_restartSphinx()" | |||
service sphinxsearch stop | |||
killall searchd 2>/dev/null | |||
rm /var/log/sphinxsearch/searchd.pid 2>/dev/null | |||
service sphinxsearch start | |||
fn_traceOUT "fn_restartSphinx()" | |||
} | |||
# MAIN | |||
export RSYNC_PASSWORD=billou | |||
fnConstructor | |||
fn_start | |||
# fn_getLastRelease | |||
fn_recupImages | |||
fn_recupData | |||
fn_recupRoot | |||
fn_dropMysql | |||
fn_createMysql | |||
fn_insertIntoMysql | |||
fn_updateData | |||
fnImportAndChangeFilesForMediawiki | |||
fnChangeFilesForApache2 | |||
fnImportAndChangeFilesForSphinxSearch | |||
fn_restartMysql | |||
fn_restartApache2 | |||
fn_reIndexe | |||
fn_restartSphinx | |||
fnDestructor | |||
exit 0 | |||
</nowiki> | |||
Dernière version du 10 mai 2020 à 15:37
PCStreet:EssaiEspaceDeNomsPCStreet essai d'espace de noms dans cet espace de noms: "" PCStreet - .
banzayonnaise2 (juste pour pouvoir tester sphinxsearch et consort).
Création d'une page à la con pour pouvoir faire des tests:
PDF:
extension SimpleEmbed (<embed width= height>)> : (pdf,jpg,png ...) <
'extension PDFInclude' (pdf,jpg,png ...)
.pcmakeUpdatePcWikiFromPc231: #!/bin/bash # mercredi 2 mai 2018, 18:23:02 (UTC+0200) # en cours: lundi 7 mai 2018, 15:12:43 (UTC+0200) # CpuPcstretien::/root/PCStreet.scripts/.pcmakeUpdatePcWiki2FromPc231 # ============================================================================== # COMMENT: # Ce script sert à importer un pcwiki à partir de pc231.pcstreet.org sur un système local PCStreetien # en gardant les includes.[ip|md5].protection.conf et htdigest par mesure de pcrécaution # ============================================================================== # GLOBALS: __strScriptName=".pcmakeUpdatePcWiki2.fromPc231" __strVersion="V2.03 du 07/05/2018" __strDateStamp="`date '+%Y%m%d'`" __strFullDateStamp="`date '+%Y%m%d-%H%M%S'`" # Définition du site qui accueille à partir d'avril 2018, c'est pc231): __strServerNameFrom="pc231" # __boolFlagFirstTime=1 # (Uniquement la 1° fois (maj de php,apache,phpmyadmin ..) __boolFlagFirstTime=0 # ============================================================================== # IMPORTED FUNCTIONS: source /root/source.functions.PC/fnStrings.sh intRet=${?} if test ${intRet} -ne 0 then echo "Impossible de charger le source '/root/source.functions.PC/fnStrings.sh'" exit 233 fi # FONCTIONS & VARIABLES GLOBALES DISPONIBLES: # __strRenameStringInLine= # fnRenameStringInLine() # __strRenameStringInFile= # fnRenameStringInFile() source /root/source.functions.PC/fnTrace.sh intRet=${?} if test ${intRet} -ne 0 then echo "Impossible de charger le source '/root/source.functions.PC/fnTrace.sh'" exit 233 fi # FONCTIONS & VARIABLES GLOBALES DISPONIBLES: # fn_traceIN() # fn_traceOUT() # ============================================================================== # FUNCTIONS: fn_stopMysql() { fn_traceIN "fn_stopMysql()" service mysql stop killall mysqld ps awwwxx|grep mysqld|grep -v grep intRet=$? if test ${intRet} -eq 0 then echo "impossible d'arrêter mysql" fi fn_traceOUT "fn_stopMysql()" } fn_startMysql() { fn_traceIN "fn_startMysql()" service mysql start ps awwwxx|grep mysqld|grep -v grep intRet=$? if test ${intRet} -ne 0 then echo "impossible de relancer mysql" exit 234 fi fn_traceOUT "fn_startMysql()" } fn_restartMysql() { fn_traceIN "fn_restartMysql()" service mysql restart fn_traceOUT "fn_restartMysql()" } fn_restartApache2() { fn_traceIN "fn_restartApache2()" if test ${__boolFlagFirstTime} -eq 1 # Uniquement la 1° fois (maj de php,apache,phpmyadmin ..) then sh /etc/init.d/apache2 force-reload # Super pour débugger: apache2ctl -t apache2ctl -S fi fn_traceOUT "fn_restartApache2()" } function fnConstructor() { fn_traceIN "fnConstructor()" touch ${0} cd /var/lib/mediawiki if test $? -ne 0 then mkdir -p /var/lib/mediawiki fi if test ${__boolFlagFirstTime} -eq 1 then sh /root/PCStreet.scripts.pcmakeInstallByHandMediawiki apt-get install -y sphinxsearch fi fn_stopMysql fn_startMysql fn_traceOUT "fnConstructor()" } function fnDestructor() { fn_traceIN "fnDestructor()" echo -n "" ps awx|grep searchd|grep -v grep ps awx|grep apache2|grep -v grep ps awx|grep mysql|grep -v grep fn_traceOUT "fnDestructor()" } fn_getLastRelease() { fn_traceIN "fn_getLastRelease()" wget releases.wikimedia.org/mediawiki/1.30/mediawiki-1.30.0.tar.gz fn_traceOUT "fn_getLastRelease()" } fn_recupImages() { # Phase I: récuperation des images à partir de $__strServerNameFrom: fn_traceIN "fn_recupImages()" rsync -avzlH --port=874 --partial --fuzzy $__strServerNameFrom::RaCiNe/var/lib/mediawiki/images /var/lib/mediawiki/ --exclude 'LocalSettings.php' fn_traceOUT "fn_recupImages()" } fn_recupData() { # Phase II: récuperation du dernier dump de la base sur $__strServerNameFrom: fn_traceIN "fn_recupData()" rsync -avzlH --port=874 --partial --fuzzy $__strServerNameFrom::RaCiNe/var/lib/mediawiki/.sauvegardes /var/lib/mediawiki/ --exclude "*.xml*" --exclude 'LocalSettings.php' fn_traceOUT "fn_recupData()" } fn_recupRoot() { # Phase III: récuperation du corps même des programmes: fn_traceIN "fn_recupRoot()" rsync -avzlH --port=874 --partial --fuzzy $__strServerNameFrom::RaCiNe/var/lib/mediawiki/ /var/lib/mediawiki/ --exclude "*.xml*" --exclude '*gz' --exclude '.sauvegardes.' --exclude 'LocalSettings.php' rsync -avzlH --port=874 --partial --fuzzy $__strServerNameFrom::RaCiNe/etc/mediawiki /etc --exclude 'LocalSettings.php' --exclude 'apache.conf' fn_traceOUT "fn_recupRoot()" } fn_dropMysql() { # Indispensable de détruire le contenu du répertoire avant de descendre la base: fn_traceIN "fn_dropMysql()" ps awx|grep mysql echo "" echo "Ne répondez pas à la question, cela va se faire tout seul" mysqladmin -u root --password=fr...ce drop wiki_pcwiki2 << EoF y EoF rm -f /var/lib/mysql/wiki_pcwiki2/* >/dev/null 2>&1 fn_stopMysql fn_startMysql fn_traceOUT "fn_dropMysql()" } fn_createMysql() { fn_traceIN "fn_createMysql()" mysqladmin -u root --password=fr...ce create wiki_pcwiki2 mysql -u root --password=fr...ce << EoF USE wiki_pcwiki2; GRANT SELECT, UPDATE, INSERT, DELETE, USAGE ON wiki_pcwiki2.* TO pchevalier; GRANT SELECT, UPDATE, INSERT, DELETE, USAGE ON wiki_pcwiki2.* TO root; GRANT SELECT, UPDATE, INSERT, DELETE, USAGE ON wiki_pcwiki2.* TO admin; GRANT SELECT, UPDATE, INSERT, DELETE, USAGE ON wiki_pcwiki2.* TO phpmyadmin; EoF fn_traceOUT "fn_createMysql()" } fn_insertIntoMysql() { fn_traceIN "fn_insertMysql()" gunzip -f /var/lib/mediawiki/.sauvegardes/wiki_pcwiki-last.sql.gz mysql -u root --password=fr...ce wiki_pcwiki2 < /var/lib/mediawiki/.sauvegardes/wiki_pcwiki-last.sql gzip -f /var/lib/mediawiki/.sauvegardes/wiki_pcwiki-last.sql fn_traceOUT "fn_insertMysql()" } fn_updateData() { fn_traceIN "fn_updateData()" # Mise à jour de la base de données: php maintenance/update.php --quick fn_traceOUT "fn_updateData()" } fnImportAndChangeFilesForMediawiki() { fn_traceIN "fnImportAndChangeFilesForMediawiki()" # Phase I: recopie de pc231::/etc/mediawiki/apache.conf mkdir -p /etc/mediawiki 2>/dev/null cd /etc/mediawiki if test $? -eq 0 then # Récuperation du fichier de conf 'pc231::/etc/mediawiki/apache.conf': RSYNC_PASSWORD=billou rsync \ -avlH \ --exclude '*.bak' \ --port=874 \ root@${__strServerNameFrom}::RaCiNe/etc/mediawiki/apache.conf /etc/mediawiki/ fnRenameStringInFile /etc/mediawiki/apache.conf ${__strServerNameFrom} debian9.vm # Récuperation du fichier de conf 'pc231:/etc/apache2/sites-available/pcwiki.pc231.debian9.vm.pcstreet.org.conf*': RSYNC_PASSWORD=billou rsync \ -avlH \ --exclude '*.bak' \ --port=874 \ root@${__strServerNameFrom}::RaCiNe/etc/apache2/sites-available/pcwiki.${__strServerNameFrom}.pcstreet.org.conf /etc/apache2/sites-available/ # Récuperation des fichiers de conf 'pc231:/etc/apache2/include.[ip,md5].protection.conf': RSYNC_PASSWORD=billou rsync \ -avlH \ --port=874 \ --exclude '*.bak' \ root@${__strServerNameFrom}::RaCiNe/etc/apache2/include.*.protection.conf /etc/apache2 # cat /etc/apache2/include.ip.protection.conf |grep 192 fnRenameStringInFile /etc/apache2/include.ip.protection.conf "192.168.1.0\/24" "192.168.0.0\/16" # echo "================================================" # cat /etc/apache2/include.ip.protection.conf |grep 192 # Récuperation du fichier des mots de passe htdigest RSYNC_PASSWORD=billou rsync \ -avlH \ --port=874 \ --exclude '*.bak' \ root@${__strServerNameFrom}::RaCiNe/etc/apache2/htdigest /etc/apache2 echo ${strToChange} fnRenameStringInFile /etc/mediawiki/apache.conf "{strToChange}" "\#" fnRenameStringInFile /etc/mediawiki/LocalSettings.php ${__strServerNameFrom} debian9.vm # Récuperation du fichier de conf 'pc231:/etc/mediawiki/LocalSettings.php': RSYNC_PASSWORD=billou rsync \ -avlH \ --port=874 \ root@${__strServerNameFrom}::RaCiNe/etc/mediawiki/LocalSettings* /etc/mediawiki/ # Récuperation du fichier de conf 'pc231:/etc/mediawiki/LocalSettings.php': RSYNC_PASSWORD=billou rsync \ -avlH \ --delete \ --port=874 \ --exclude "LocalSettings.php" \ root@${__strServerNameFrom}::RaCiNe/var/lib/mediawiki /var/lib/ rm -f /var/lib/mediawiki/LocalSettings.php 2>/dev/null ln -s /etc/mediawiki/LocalSettings.php /var/lib/mediawiki rm -f /var/www/mediawiki 2>/dev/null rm -f /var/www/html/mediawiki 2>/dev/null ln -s /var/lib/mediawiki /var/www/html/mediawiki fnRenameStringInFile /etc/mediawiki/apache.conf ${__strServerNameFrom} debian9.vm fnRenameStringInFile /etc/mediawiki/LocalSettings.php ${__strServerNameFrom} debian9.vm fi fn_traceOUT "fnImportAndChangeFilesForMediawiki()" } fnChangeFilesForApache2() { fn_traceIN "fnChangeFilesForApache2()" # Phase II: installation des fichiers de conf apache (liés à /etc/mediawiki/apache.conf) cd /etc/apache2 if test $? -eq 0 then # Récuperation du fichier de conf 'pc231:/etc/apache2/sites-available/pcwiki.pc231.pcstreet.org.conf:' rm -f /etc/apache2/sites-available/pcwiki.${__strServerNameFrom}.pcstreet.org.conf 2>/dev/null rm -f /etc/apache2/sites-enabled/pcwiki.${__strServerNameFrom}.pcstreet.org.conf 2>/dev/null rm -f /etc/apache2/sites-available/pcwiki.debian9.vm.pcstreet.org.conf 2>/dev/null rm -f /etc/apache2/sites-enabled/pcwiki.debian9.vm.pcstreet.org.conf 2>/dev/null ln -s /etc/mediawiki/apache.conf /etc/apache2/sites-available/pcwiki.debian9.vm.pcstreet.org.conf ln -s /etc/apache2/sites-available/pcwiki.debian9.vm.pcstreet.org.conf /etc/apache2/sites-enabled/pcwiki.debian9.vm.pcstreet.org.conf fi service apache2 stop killall apache2 2>/dev/null service apache2 start fn_traceOUT "fnChangeFilesForApache2()" } fnImportAndChangeFilesForSphinxSearch() { fn_traceIN "fnImportAndChangeFilesForSphinxSearch()" # Phase III: recopie de pc231:/etc/sphinxsearch/sphinx.conf mkdir -p /etc/sphinxsearch 2>/dev/null cd /etc/sphinxsearch if test $? -eq 0 then # Récuperation du fichier de conf 'pc231:/etc/sphinxsearch/sphinx.conf': RSYNC_PASSWORD=billou rsync \ -avlH \ --port=874 \ root@${__strServerNameFrom}::RaCiNe/etc/sphinxsearch/sphinx.conf /etc/sphinxsearch fnRenameStringInFile /etc/sphinxsearch/sphinx.conf ".1.231:" ".122.211:" fnRenameStringInFile /etc/default/sphinxsearch "START=no" "START=yes" fi service sphinxsearch stop killall sphinxsearch 2>/dev/null service sphinxsearch start fn_traceOUT "fnImportAndChangeFilesForSphinxSearch()" } # Indispensable car sinon, les liens trouvés vont renvoyer vers pc231: fn_reIndexe() { fn_traceIN "fn_reIndexe()" /bin/bash /root/PCStreet.scripts/.pcmakeSphinxIndexer fn_traceOUT "fn_reIndexe()" } fn_restartSphinx() { fn_traceIN "fn_restartSphinx()" service sphinxsearch stop killall searchd 2>/dev/null rm /var/log/sphinxsearch/searchd.pid 2>/dev/null service sphinxsearch start fn_traceOUT "fn_restartSphinx()" } # MAIN export RSYNC_PASSWORD=billou fnConstructor fn_start # fn_getLastRelease fn_recupImages fn_recupData fn_recupRoot fn_dropMysql fn_createMysql fn_insertIntoMysql fn_updateData fnImportAndChangeFilesForMediawiki fnChangeFilesForApache2 fnImportAndChangeFilesForSphinxSearch fn_restartMysql fn_restartApache2 fn_reIndexe fn_restartSphinx fnDestructor exit 0