Сценарии Shell Сравнение версий

Различия

Здесь показаны различия между двумя версиями данной страницы.

Ссылка на это сравнение

Предыдущая версия справа и слева Предыдущая версия
Следующая версия
Предыдущая версия
wiki:руководство_по_ubuntu_server:резервное_копирование:shell_scripts [2012/09/20 21:08]
[Выполнение сценария]
wiki:руководство_по_ubuntu_server:резервное_копирование:shell_scripts [2012/09/20 21:43] (текущий)
[Ссылки]
Строка 108: Строка 108:
 ====Восстановление из архива==== ====Восстановление из архива====
  
-Once an archive has been created it is important to test the archiveThe archive can be tested by listing the files it containsbut the best test is to restore a file from the archive.+Как только архив создан,​ важно проверить архивАрхив может быть проверен выводом списка файлов,​ которые в нем находятсяно лучшей проверкой будет восстановление файлов из архива.
  
-    To see a listing of the archive contentsFrom a terminal prompt type:+ 1Чтобы посмотреть содержимое архива,​ наберите в терминале: 
 +<​code>​tar -tzvf /​mnt/​backup/​host-Monday.tgz</​code>​
  
-    ​tar -tzvf /​mnt/​backup/​host-Monday.tgz+ 2. Чтобы восстановить файлы из архива в другой каталог введите:​ 
 +<​code>​tar -xzvf /​mnt/​backup/​host-Monday.tgz ​-C /tmp etc/​hosts</​code>​ 
 +Параметр **//-C//** команды **//tar//** перенаправляет извлекаемые файлы в указанный каталог. Приведенный пример извлечет файл /etc/hosts в /​tmp/​etc/​hosts. **tar** создает заново структуру каталогов для извлекаемых файлов.
  
-    To restore a file from the archive to a different directory enter:+Также обратите внимание на отсутствие лидирующего %%"/"​%% в пути извлекаемого файла.
  
-    tar -xzvf /​mnt/​backup/​host-Monday.tgz -C /tmp etc/hosts + 3Для восстановления всех файлов архива введите следующее
- +<​code>​ 
-    The -C option to tar redirects the extracted files to the specified directory. The above example will extract the /etc/hosts file to /​tmp/​etc/​hosts. tar recreates the directory structure that it contains. +cd / 
- +sudo tar -xzvf /​mnt/​backup/​host-Monday.tgz 
-    Also, notice the leading "/"​ is left off the path of the file to restore. +</​code>​ 
- +<​note>​Это перепишет все файлы, находящиеся в файловой системе.</​note>​
-    To restore all files in the archive enter the following+
- +
-    cd / +
-    sudo tar -xzvf /​mnt/​backup/​host-Monday.tgz +
- +
-This will overwrite the files currently on the file system.+
  
 ====Ссылки==== ====Ссылки====
  
-    For more information on shell scripting see the Advanced Bash-Scripting Guide +  ~~ Для дополнительной информации по shell сценариям смотрите руководство [[http://​tldp.org/​LDP/​abs/​html/​|Advanced Bash-Scripting Guide]]. 
- +  ~~ Книга [[http://​safari.samspublishing.com/​0672323583|Teach Yourself Shell Programming in 24 Hours]] доступна в сети и является замечательным ресурсом для создания ​shell сценариев
-    The book Teach Yourself Shell Programming in 24 Hours is available online and a great resource for shell scripting+  ~~ Страница [[https://​help.ubuntu.com/​community/​CronHowto|CronHowto Wiki]] содержит подробности по дополнительным опциям **cron**
- +  ~~ Смотрите руководство [[http://​www.gnu.org/​software/​tar/​manual/​index.html|GNU tar Manual]] для дополнительных параметров **tar**
-    The CronHowto Wiki Page contains details on advanced ​cron options+  ~~ Статья [[http://​en.wikipedia.org/​wiki/​Backup_rotation_scheme|Wikipedia Backup Rotation Scheme]] содержит информацию по другим схемам ротации архивов
- +  ~~ Shell сценарий использует **tar** для создания архивано существует много других утилит,​ которые можно использоватьНапример
-    See the GNU tar Manual ​for more tar options+    ~~ [[http://​www.gnu.org/​software/​cpio/​|cpio]]используется для копирования файлов в и из архива
- +    ~~ [[http://​www.gnu.org/​software/​coreutils/​|dd]]часть пакета **coreutils**Утилита нижнего уровня,​ которая может копировать данные из одного формата в другой
-    The Wikipedia Backup Rotation Scheme ​article contains information on other backup rotation schemes+    ~~ [[http://​www.rsnapshot.org/​|rsnapshot]]утилита получения снимка файловой системы,​ используемая для получения копий всей файловой системы
- +    ~~ [[http://​www.samba.org/​ftp/​rsync/​rsync.html|rsync]]гибкая утилита,​ используемая для копирования измененных частей файлов (инкрементное копирование).
-    The shell script uses tar to create the archivebut there many other command line utilities that can be usedFor example+
- +
-        ​cpio: used to copy files to and from archives+
- +
-        ​dd: part of the coreutils ​packageA low level utility that can copy data from one format to another+
- +
-        ​rsnapshot: ​a file system snapshot utility used to create copies of an entire file system+
- +
-        ​rsync: ​a flexible utility used to create incremental copies of files. +
  
 ---- ----