version=pmwiki-2.2.0-beta42 ordered=1 urlencoded=1 agent=Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.3) Gecko/20070309 Firefox/2.0.0.3 author=Anno charset=ISO-8859-1 csum=summary ctime=1134693395 host=85.125.178.31 name=PmWiki.BackupAndRestore rev=8 targets=PmWiki.DocumentationIndex text=(:Summary:background information and some basic backup and restore procedures:)%0a%0aThis page has some background information on making backups and explains some basic *nix backup and restore procedures.%0a%0a!! Introduction%0a%0aYour wiki installation contains some unique data in the following directories:%0a%0a local/ Local configuration scripts%0a cookbook/ Recipes obtained from the [[(Cookbook:)Cookbook]]%0a pub/ Publicly accessible files%0a wiki.d/ Wiki pages%0a uploads/ Uploaded files (attachments)%0a%0aA good backup plan will include periodically archiving these directories — or at bare minimum [@local/@] and [@wiki.d/@]. Good practice dictates keeping your backup archives on a separate machine.%0a%0a!! Simple Backup and Restore (*nix)%0a%0aWhen it comes to backup, simpler is better. Since the pmwiki distribution is very small (about 1/4 megabyte), it's simplest to just archive the distribution files along with the data.%0a%0a!!! Making a Backup Archive%0a%0aThe following *nix command, executed from the parent directory of your wiki's directory, will put a complete backup archive of your site in your home directory.%0a%0a-> [@%0atar -zcvf ~/wiki-backup-`date +%25Y%25m`.tar.gz wiki/%0a@]%0a%0a!!! Restoring the Backup Archive%0a%0a!!!! Simple Method%0a%0aYour site can be restored and running in under 30 seconds with%0a%0a-> [@%0atar -zxvf ~/wiki-backup-200512.tar.gz%0afind wiki/uploads/ -type d |xargs chmod 777%0afind wiki/wiki.d/ -type d |xargs chmod 777%0a@]%0a%0a!!!! A Slightly-More-Secure Method%0a%0aThe simple restore commands above will give you world-writable files and directories. You can avoid world-writable permissions by letting PmWiki create directories with the proper attributes (ownership and permissions) for you.%0a%0aStart with%0a%0a-> [@%0atar -zxvf ~/wiki-backup-200512.tar.gz%0arm -rf wiki/wiki.d%0arm -rf uploads%0achmod 2777 wiki/%0a@]%0a%0aNow upload a file in each group that had uploads. If your site doesn't have uploads, just visit your site once so the wiki.d/ directory will be created.%0a%0aFinish your installation with%0a%0a-> [@%0achmod 755 wiki/%0atar -zxvf ~/wiki-backup-200512.tar.gz%0a@]%0a%0a%0a!!! Details%0a%0aThe commands on this page assume your site is in a directory called "wiki/". The test backup was made in December, 2005 so it's named accordingly.%0a%0aYour site will only have an uploads/ directory if uploads are enabled.%0a%0aThe backup command uses a date stamp (YYYYMM) in the filename. If you automate the command via cron you'll wind up with monthly snapshots of your site. You can get a daily snapshot by appending %25d to the date command ([@`date +%25Y%25m%25d`@] will get you YYYYMMDD). Be wary of space limitations if you have a large uploads/ directory.%0a%0a%0a!! See Also%0a%0a* A [[http://thread.gmane.org/gmane.comp.web.wiki.pmwiki.user/20317| thread]] [gmane.org] on the pmwiki-users mailing list.%0a* A [[(Cookbook:)BackupPages]] recipe in the cookbook.%0a%0a%25trail%25%3c%3c|[[DocumentationIndex]]|>> time=1176388852