Debian: Restore Backup Wiki

From OnnoWiki
Jump to navigation Jump to search

Asumsi

user mysql ROOT
pass mysql PASSWORD
path data /var/data/library/datawiki/
database mediawiki

script

/bin/rm -Rf /usr/local/src/var
/bin/rm -Rf /usr/local/src/wikidb*
/bin/cp -Rf /var/data/library/datawiki/* /usr/local/src
# /bin/rm -Rr /usr/local/src/wikidb.sql
/bin/mkdir -p /usr/local/src/var/www/html/wiki/images
cd /usr/local/src
/bin/tar zxvf images.tar.gz
# /bin/tar zxvf wikidb.sql.tar.gz
/bin/cp -Rf /usr/local/src/var/www/html/wiki/images /var/www/html/wiki/
/bin/chown -Rf www-data.www-data /var/www/html/wiki
/usr/sbin/service mysql stop
/usr/sbin/service mysql start
/usr/bin/mysqladmin --user=ROOT --password=PASSWORD --force drop mediawiki 
/usr/bin/mysqladmin --user=ROOT --password=PASSWORD create mediawiki
/usr/bin/mysql -u ROOT -pPASSWORD mediawiki < /var/www/html/wiki/maintenance/tables.sql
/usr/bin/mysql -u ROOT -pPASSWORD mediawiki < /usr/local/src/wikidb.sql
/usr/sbin/service mysql stop
/usr/sbin/service mysql start
cd /var/www/html/wiki/maintenance
/usr/bin/php5 update.php
/usr/sbin/service mysql stop
/usr/sbin/service mysql start
/bin/chown -Rf nobody.nogroup /var/data &
/bin/chmod -Rf 777 /var/data &