Automatized backup of files and directories

This is again a script that people could write easily if they understood some shell scripting, but it is quite well implemented with logging and all and maybe spares a couple of minutes/hours of your time. Smile

You should use it with crontab on a daily basis. For details take a look at the desc. of the MySQL backup script.

filesystem_backup-1.0.0.zsh3.53 KB
filesystem_backup-1.1.0.zsh3.45 KB
filesystem_backup-1.2.0.zsh3.45 KB
filesystem_backup-1.3.0.zsh3.53 KB
filesystem_backup-1.4.0.zsh3.54 KB
filesystem_backup-1.5.0.zsh3.67 KB


Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Filesystem backup v1.3.0

  • use of nice (with "-n +19") to limit the CPU resources consumed by the bzip2 compression
  • use if quotes around all path related shell variables

Filesystem backup v1.4.0

  • The "days" variable was not used properly in the cleanup code, find ... -mtime +${days} returned ${days}+2 items. Replaced it with an ls -1t + tail -n +$((days+1)) combo.
  • In case the directory specified by the "backupdir" variable was not writable, the script still tried to log an error message in that directory.

Filesystem backup v1.5.0

  • The days variable can now be specified for each do_backup invocation separately. Note that this breaks backward compatibility if you used previously the third option of do_backup for specifying find parameters. If that's the case, you've to insert now a - sign before the find parameter list so the script'll use the global days value for the given do_backup invocation (as it did before).