Dokuwiki backup script

Script to backup dokuwiki. Include it in /etc/cron.daily. Update the relevant file locations.

dokuwiki_backup
#!/bin/sh
#
# Dokuwiki backup script
#
NOW=$(date +"%Y-%m-%d-%H-%M-%S")
#
DOKUWIKILOC="/path/to/dokuwiki/data"
BACKUPLOC="/path/to/backups"
DOKUWIKIBACKUPLOC="$BACKUPLOC/dokuwiki"
# Change to denote each wiki
DWBKPREFIX=dw18vb
 
if [ ! -d $DOKUWIKIBACKUPLOC ]; then
  echo "Backup directory $DOKUWIKIBACKUPLOC is missing."
  exit 1
fi
 
BACKUPFILE="$DOKUWIKIBACKUPLOC/${DWBKPREFIX}-backup-${NOW}.tar.gz"
BACKUPLOG="$DOKUWIKIBACKUPLOC/${DWBKPREFIX}-backup-${NOW}.log"
#
# Backup Data
tar -zcvf $BACKUPFILE -C $DOKUWIKILOC . > $BACKUPLOG 2>&1
chmod 600 $BACKUPFILE
#
# Delete old backups and logs
/usr/bin/find $DOKUWIKIBACKUPLOC/${DWBKPREFIX}-backup*.tar.gz -mtime +35 -exec rm {} \;
/usr/bin/find $DOKUWIKIBACKUPLOC/${DWBKPREFIX}-backup*.log -mtime +35 -exec rm {} \;
#
exit 0

Table of Contents
QR Code
QR Code tech:others:dokuwiki_backup (generated for current page)