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 [2019-02-21 08:08] Aleksandrtips:maintenance [2023-10-10 20:28] (current) – Updated to fix errors with the fact if -e does not work for globs. staze
Line 16: Line 16:
 #!/bin/bash #!/bin/bash
  
-function cleanup()+cleanup()
 { {
     local data_path="$1"        # full path to data directory of wiki     local data_path="$1"        # full path to data directory of wiki
Line 22: Line 22:
  
     # purge files older than ${retention_days} days from attic and media_attic (old revisions)     # purge files older than ${retention_days} days from attic and media_attic (old revisions)
-    find "${data_path}"/{media_,}attic/ -type f -mtime +${retention_days} -delete+    find "${data_path}"/{media_,}attic/ -type f -not -name _dummy -mtime +"${retention_days}-delete
  
     # remove stale lock files (files which are 1-2 days old)     # remove stale lock files (files which are 1-2 days old)
Line 32: Line 32:
  
     # remove files older than ${retention_days} days from the cache     # remove files older than ${retention_days} days from the cache
-    if -"${data_path}"/cache/?/ ]+    if test -n "$(find "${data_path}"/cache/?/ -maxdepth 1 -print -quit &> /dev/null)"
     then     then
-        find "${data_path}"/cache/?/ -type f -mtime +${retention_days} -delete+        find "${data_path}"/cache/?/ -type f -not -name _dummy -mtime +"${retention_days}-delete
     fi     fi
 } }
 +
  
 # cleanup DokuWiki installations (path to datadir, number of days) # cleanup DokuWiki installations (path to datadir, number of days)
Line 187: 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 ==== ==== Problems with CAPTCHA plugin ====
tips/maintenance.1550732881.txt.gz · Last modified: 2019-02-21 08:08 by Aleksandr

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