DokuWiki

It's better when it's simple

User Tools

Site Tools


tips:maintenance

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
tips:maintenance [2013-04-29 20:21] – [Maintenance] 190.27.194.177tips:maintenance [2023-10-10 20:28] (current) – Updated to fix errors with the fact if -e does not work for globs. staze
Line 1: Line 1:
 ====== Maintenance ====== ====== Maintenance ======
    
 +Here are some tips to automate some of the day-to-day maintenance needed or recommended for DokuWiki.
  
- +See also the plugins: [[plugin:cleanup|cleanup]] and [[plugin:clearhistory|clearhistory]]
-Here are some tips to automate some of the day-to-day maintenance needed or recommended for DokuWiki.+
  
 ===== Keep Blacklist up to date ===== ===== Keep Blacklist up to date =====
Line 11: Line 11:
 ===== Automatic cleanup script ===== ===== Automatic cleanup script =====
  
-It is recommended to set up some cleanup process for busy DokuWikis. The following [[wp>Bash (Unix shell)]] shell script serves as an example. It deletes old revisions from the [[:attic]], removes stale lock files and empty directories, and it cleans up the [[:caching|cache]]((For a discussion of cache maintenance see also the [[http://forum.dokuwiki.org/post/22265|forum discussion]].)).+It is recommended to set up some cleanup process for busy DokuWikis. The following [[wp>Bash (Unix shell)]] shell script serves as an example. It deletes old revisions from the [[:attic]], removes stale lock files and empty directories, and it cleans up the [[:caching|cache]]((For a discussion of cache maintenance see also the [[https://forum.dokuwiki.org/post/22265|forum discussion]].)).
  
 <file bash cleanup.sh> <file bash cleanup.sh>
 #!/bin/bash #!/bin/bash
  
-cleanup() {+cleanup() 
 +{ 
 +    local data_path="$1"        # full path to data directory of wiki 
 +    local retention_days="$2"   # number of days after which old files are to be removed
  
-  # $1 ... full path to data directory of wiki +    purge files older than ${retention_days} days from attic and media_attic (old revisions) 
-  # $2 ... number of days after which old files are to be removed+    find "${data_path}"/{media_,}attic/ -type f -not -name _dummy -mtime +"${retention_days}" -delete
  
-  purge files older than $2 days from attic and media_attic (old revisions+    remove stale lock files (files which are 1-2 days old) 
-  find "$1"/{media_,}attic/ -type f -mtime +$2 -print0 | xargs -0r rm -f+    find "${data_path}"/locks-name '*.lock' -type f -mtime +-delete
  
-  # remove stale lock files (files which are 1-2 days old) +    # remove empty directories 
-  find "$1"/locks/ -name '*.lock' -type f -mtime +1 -print0 | xargs -0r rm -f+    find "${data_path}"/{attic,cache,index,locks,media,media_attic,media_meta,meta,pages,tmp}
 +        -mindepth 1 -type -empty -delete
  
-  # remove empty directories +    # remove files older than ${retention_days} days from the cache 
-  find "$1"/{attic,cache,index,locks,media,media_attic,media_meta,meta,pages,tmp}+    if test -n "$(find "${data_path}"/cache/?/ -maxdepth 1 -print -quit &> /dev/null)" 
-    -mindepth 1 -type d -empty -print0 | xargs -0r rmdir +    then 
- +        find "${data_path}"/cache/?/ -type f -not -name _dummy -mtime +"${retention_days}" -delete 
-  # remove files older than $2 days from the cache +    fi
-  find "$1"/cache/?/ -type f -mtime +$-print0 | xargs -0r rm -f+
 } }
 +
  
 # cleanup DokuWiki installations (path to datadir, number of days) # cleanup DokuWiki installations (path to datadir, number of days)
Line 51: Line 55:
 ==== Windows -- warmzip ==== ==== Windows -- warmzip ====
  
-A script for cleaning out old files on Windows systems is [[http://winadmin.forret.com/|waRmZip]], available from [[http://sourceforge.net/project/showfiles.php?group_id=88417|here on SourceForge]]. Write a batch file to call it, and schedule it to run every day. And as the man says: 'Be sure to set everything up correctly' ;-)+A script for cleaning out old files on Windows systems is [[http://winadmin.tumblr.com/post/8005353779/warmzip-clean-up-folders-by-compressing-moving|waRmZip]], available from [[http://sourceforge.net/project/showfiles.php?group_id=88417|here on SourceForge]]. Write a batch file to call it, and schedule it to run every day. And as the man says: 'Be sure to set everything up correctly' ;-)
  
 I took the above suggestion to use ''waRmZip'' and wrote this batch file - maybe it will help out. I took the above suggestion to use ''waRmZip'' and wrote this batch file - maybe it will help out.
  
-My favorite way to run cron jobs on Windows is [[http://www.kalab.com/freeware/pycron/pycron.htm|PyCron]].+My favorite way to run cron jobs on Windows is [[https://sourceforge.net/projects/pycron|PyCron]].
  
 <file dos dw-cleanup.bat> <file dos dw-cleanup.bat>
Line 80: Line 84:
  
 ==== Windows -- batch script ==== ==== Windows -- batch script ====
 +
 This is another Windows command shell script for maintaining your dokuwiki base on a Windows environment. This is another Windows command shell script for maintaining your dokuwiki base on a Windows environment.
 The script uses the free and open source utility find, which can be obtained via [[http://gnuwin32.sourceforge.net/]] The script uses the free and open source utility find, which can be obtained via [[http://gnuwin32.sourceforge.net/]]
Line 183: Line 188:
 Example: Restore Playground every 30 min: Example: Restore Playground every 30 min:
  
-  0,30 * * * * cp -pf /path/to/savedwiki/data/pages/playground/playground.txt /path/to/dokuwiki/data/pages/playground/+  0,30 * * * * cp -/path/to/savedwiki/data/pages/playground/playground.txt /path/to/dokuwiki/data/pages/playground/
  
 Example: Restore all pages in [[:namespace]] "wiki" every 30 min: Example: Restore all pages in [[:namespace]] "wiki" every 30 min:
  
-  0,30 * * * * cp -rpf /path/to/savedwiki/data/pages/wiki/ /path/to/dokuwiki/data/pages/wiki/+  0,30 * * * * cp -rf /path/to/savedwiki/data/pages/wiki/ /path/to/dokuwiki/data/pages/wiki/ 
 + 
 +==== Problems with CAPTCHA plugin ==== 
 + 
 +Using the CAPTCHA plugin and the recommended [[tips:maintenance#keeping_playground_clean|maintenance method]] to keep the playground clean, can result in the effect of being unable to edit the playground. 
 + 
 +When this occurs, the problem can be easily resolved by removing the related playground files in the meta folder with the next cronjob. 
 + 
 +Example: Deletes Playground metafiles every 30 min: 
 +  0,30 * * * * rm -f /path/to/dokuwiki/data/meta/playground/playground.*
  
 ===== When cronjob is not available ===== ===== When cronjob is not available =====
Line 203: Line 217:
 ---- ----
  
-Could someone add the appropriate line for [[http://forum.dokuwiki.org/post/22265|cache maintenance]] to the Windows waRmZip script?+Could someone add the appropriate line for [[https://forum.dokuwiki.org/post/22265|cache maintenance]] to the Windows waRmZip script
 +---- 
 +Does the [[plugin:cleanup|cleanup Plugin]] handle all the above tasks? Would it be recommended over running these scripts?
  
 ---- ----
Line 268: Line 284:
 </file> </file>
 use this at your own risk. --- [[user>goldseed|S.C. Yoo]] //2012/02/10 12:49// use this at your own risk. --- [[user>goldseed|S.C. Yoo]] //2012/02/10 12:49//
 +
 +----
 +Cheers, I'd like to add that it is a good idea to clean up orphaned meta data, don't you think?
 +I do the following (in an R script):
 +  -list all files in the pages directory recursively
 +  -add a column 'pagename' to this list that countains the file name again but without the base directory
 +  -in pagename exchange '/' (or '\') with ':' and remove the file extension
 +  -do the same for the meta directory + exclude some additional files
 +  -remove all entries from the meta-list from which the page name is in the pages-list
 +  -delete all files left in the meta list
 +Of course one could add a time constraint on it so that you don't use metadata immediately.
 +
 +Clemo //2016/09/23 sometime//
  
tips/maintenance.1367259697.txt.gz · Last modified: 2013-04-29 20:21 by 190.27.194.177

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki