📜 ⬆️ ⬇️

Daily web project archiving

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

Requirements: Windows (I have 2000 at work), the mysqldump command is immediately accessible from the command line, WinRAR or any other archiver working from the command line.

@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 "../"

')
The script can be launched manually or by the scheduler on a schedule (a standard system scheduler is sufficient). Linuksoids can easily rewrite this script for their system.

When running 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 17.12.2007.sql " and " htdocs-Mon ​​17.12.2007.rar ". New day - 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.

Source: https://habr.com/ru/post/17633/


All Articles