Update database SpeedyWiki lokal secara automatis tanpa update Image

From OnnoWiki
Revision as of 12:08, 24 November 2010 by Onnowpurbo (talk | contribs)
Jump to navigation Jump to search

Script berikut hanya mengupdate database saja. Tanpa mengupdate gambar supaya lebih ringan kerja di jaringan.

Asumsi

username root
password 123456
database mediawiki
Lokasi file wikidb.sql.gz di /var/data/library/datawiki/
Lokasi file wikidb.sql.gz di /usr/local/src

Buat Script misalnya

vi /usr/local/bin/updatewikidb.sh

Isi dengan

rm -Rf /usr/local/src/var
rm -Rf /usr/local/src/wikidb*
wget http://125.160.17.21/speedyorari/view.php?file=datawiki/wikidb.sql.gz -O /var/data/library/datawiki/wikidb.sql.gz
cp -Rf /var/data/library/datawiki/* /usr/local/src
cd /usr/local/src
gunzip wikidb.sql.gz
chown -Rf www-data.www-data /var/www/wiki
service mysql stop
service mysql start
mysqladmin --user=root --password=123456 --force drop mediawiki
mysqladmin --user=root --password=123456 create mediawiki
mysql -u mediawiki -pmediawiki mediawiki < /var/www/wiki/maintenance/tables.sql
mysql -u mediawiki -pmediawiki mediawiki < /usr/local/src/wikidb.sql
service mysql stop
service mysql start
cd /var/www/wiki/maintenance
php update.php
service mysql stop
service mysql start
chown -Rf nobody.nogroup /var/data &
chmod -Rf 777 /var/data &


Ijinkan untuk di jalankan

chmod -Rf 777 /usr/local/bin

Set cron

crontab -e

isi

0 2 * * * /usr/local/bin/updatewikidb.sh

Pranala Menarik

Pembuatan Distro