Add new comment

Бэкап сайта в облако

Как

Вот рецепт. Логинимся root-ом и создаем скрипт:

touch backup-now.sh

Далее прячем его от посторонних и делаем исполняемым:

chmod 0700 backup-now.sh

Текст скрипта будет примерно таким:

#!/bin/bash

SERVER_NAME="server1"
TIME=`date +%Y-%b`

FS_FILE=/tmp/$SERVER_NAME-fs.$TIME.tar.gz
MYSQL_FILE=/tmp/$SERVER_NAME-mysql.$TIME.sql.gz

# Archiving filesystem
tar -czf $FS_FILE /etc /root /home

# Archiving databases
mysqldump -u root --password=qwerty --all-databases | gzip > $MYSQL_FILE

# Uploading to the cloud
curl --user USER:PASSWORD -T "{$FS_FILE,$MYSQL_FILE}" https://webdav.yandex.ru/

# Cleanup
unlink $FS_FILE
unlink $MYSQL_FILE

Категория: 
The code has been tested and works
Мультитег: 

Filtered HTML

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.