Daily archiving of web projects

    Here is such a thing I did today. And before that - a year ago, working in a web studio.
    We offer you a bat script for daily archiving the home directory of your site and database (MySQL).

    Requirements: Windows (at my work - 2000), the mysqldump command available immediately from the command line, WinRAR or any other archiver working from the command line. The script can be run manually or by the scheduler according to the schedule (a standard system scheduler is enough). Linux systems can easily rewrite this script for their system. When executed in a Windows 2000 environment, a directory of the type " Mon 17.12.2007 " is generated , and there are two files in it - " drupal-Mon 12.17.2007.sql

    @echo off
    set DATE = `date \T`
    @md "%DATE%"
    cd "%DATE%"
    mysqldump drupal -u root > "drupal-%DATE%.sql"
    "C:\Program Files\WinRAR\rar.exe" a -inul "htdocs-%DATE%.rar" c:\apache\htdocs
    cd "../"

    "and" htdocs-Mon ​​12 / 17 / 2007.rar ". A new day - a new directory. The advantage of a separate directory is that you can create several backups of different sites.

    And finally - if someone knows how to change the date format to 2007 -12-12 - please write.

    Also popular now: