落絮飞雁的个人网站

顺流而下,把梦做完

Automatically Backup Dokuwiki Data Using Shell Script

Dokuwiki is an elegant and concise wiki-site. Since it uses plain text files instead of a database to store pages, one offline copy could be useful for some situations, like read it on your Kindle when you go offline or publish your ebook. Thus, we want to back up our pages and media file daily and create a symbolic link to the latest copy for downloads.

The official Dokuwiki provides varies of backup scripts. Unfortunately, the bash script is no longer working since Dokuwiki changed project structure, so I modified this script and added some feature. This script is tested under bash and I think it probably works in other shell environments as well.

Shell file: https://gist.github.com/luoxufeiyan/8d4ce8ffd2a7a8d83e63ea47c8f6e3a2

In this scenario, we compress the Dokuwiki pages and media folder which contains the text content and accessories like pictures. These two folders locate under the your_doku_path/data directory (NOT Doku directory), so change your WIKIPATH constant to your_doku_path/data, like /var/www/wiki.luoxufeiyan.com/data. All the backed up files will be stored in BACKUPPATH, furthermore, two symbolic links will be generated to the backup path for downloads, so if you want others to download your wiki, make sure the backup folder is visible for visitors and spread these two URL, otherwise comment the last two lines of script and set folder permission invisible for visitors. To periodically backup and update files, you may need to set up a cron job, simply add your time-frequency and command /usr/bin/bash /your_script_path/dw-backup.sh to crontab and that’s it.

Wist this script helps and if you found any issue, please contact me or leave a comment below.

Ref: How to backup DokuWiki?


原始链接:Automatically Backup Dokuwiki Data Using Shell Script|落絮飞雁的个人网站
授权协议:创作共用 署名-非商业性使用 2.5 中国大陆
除注明外,本站文章均为原创;转载时请保留上述链接。