DokuWiki

It's better when it's simple

User Tools

Site Tools


tips:backup_script

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:backup_script [2014-01-13 00:22] – [Backup Script] 2.85.81.18tips:backup_script [2024-01-08 13:29] (current) 84.136.35.186
Line 28: Line 28:
 -- dp <paul@thewall.de> -- dp <paul@thewall.de>
  
-<code bash>+<file bash dw-backup.sh>
 #!/bin/sh #!/bin/sh
 # $Id: dw-backup.sh 328 2004-12-22 13:15:20Z dp $ # $Id: dw-backup.sh 328 2004-12-22 13:15:20Z dp $
Line 88: Line 88:
  
 # create an archive backup? # create an archive backup?
-if [ `date +%d` == "01" ]+if [ `date +%d` = "01" ]
 then then
  cp "/tmp/data.1.tar.bz2" "${BACKUPPATH}/data/archive/data-"`date +%m-%d-%Y`".tar.bz2"  cp "/tmp/data.1.tar.bz2" "${BACKUPPATH}/data/archive/data-"`date +%m-%d-%Y`".tar.bz2"
Line 97: Line 97:
 mv "/tmp/data.1.tar.bz2" "${BACKUPPATH}/data/daily" mv "/tmp/data.1.tar.bz2" "${BACKUPPATH}/data/daily"
 mv "/tmp/media.1.tar.bz2" "${BACKUPPATH}/media/daily" mv "/tmp/media.1.tar.bz2" "${BACKUPPATH}/media/daily"
-</code+</file
-correction: in the above script I had to make following change to work \\  +
-if [ `date +%d` = "01" ] \\  +
-that is: = , not ==+
  
 ===== An rsync alternative ===== ===== An rsync alternative =====
 The script above works perfectly fine, thanks! The script above works perfectly fine, thanks!
  
-That being said, for bigger wiki sites the archive might grow very big with a daily tar file of the whole web site, especialy the ''media'' directory. \\+That being said, for bigger wiki sites the archive might grow very big with a daily tar file of the whole web site, especially the ''media'' directory. \\
 Furthermore, I'd like to be able to run the backup script on a trusted and more secure server. Thus here is another way of doing the backup, possibly on another server, that will keep only one copy of the site plus daily differences using ''rsync''. Furthermore, I'd like to be able to run the backup script on a trusted and more secure server. Thus here is another way of doing the backup, possibly on another server, that will keep only one copy of the site plus daily differences using ''rsync''.
  
-This script is far from being well written, so please feel free to do any improvments you like! +This script is far from being well written, so please feel free to do any improvements you like! 
  
-<code bash> +<file bash rsync-dw-backup.sh
-#!/bin/sh+#!/bin/bash
 #======================== #========================
 # backup script for stuff on wiki to be run periodically through a crontab on a trusted server # backup script for stuff on wiki to be run periodically through a crontab on a trusted server
Line 195: Line 193:
     tar -cjf ${backupdir}/archive/${bkname}-${mydate}.tar.bz2 ./${bkname}-0     tar -cjf ${backupdir}/archive/${bkname}-${mydate}.tar.bz2 ./${bkname}-0
 fi fi
-</code+</file
-The script use an //exclude// file, listing all file and dir "patern name" you wish not to include in the backup. Here is a copy of my ''wwwbackup-exclude-list.txt'' file:+The script uses an //exclude// file, listing all file and dir "pattern name" you wish not to include in the backup.\\ 
 +Here is a copy of my ''wwwbackup-exclude-list.txt'' file:
 <file> <file>
 data/.cache/* data/.cache/*
Line 348: Line 347:
 ===== windows command line script ===== ===== windows command line script =====
  
-Although wndows "ms dos shell" is not powerful as Unix shells, it can handle a lot of problems with or without thirdy part programs ([[http://www.robvanderwoude.com/batchfiles.php|Some examples]]). For this script you must install (or unzip) the [[http://www.ncftp.com/ncftp/|ncftp client executables]], and then you can run the following script:+Although wndows "ms dos shell" is not powerful as Unix shells, it can handle a lot of problems with or without third party programs ([[http://www.robvanderwoude.com/batchfiles.php|Some examples]]). For this script you must install (or unzip) the [[http://www.ncftp.com/ncftp/|ncftp client executables]], and then you can run the following script:
  
 <code dos ncFtpGetDokuWikiBackup.bat> <code dos ncFtpGetDokuWikiBackup.bat>
tips/backup_script.1389568959.txt.gz · Last modified: 2014-01-13 00:22 by 2.85.81.18

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