From 0c70ee4a5b86b8fad7aef7bf8ef1ee18dacb0897 Mon Sep 17 00:00:00 2001 From: miguel Date: Wed, 19 Apr 2023 11:38:21 +0100 Subject: [PATCH] docs(backup-manager): improve readme and audit by adding examples --- subjects/devops/backup_manager/README.md | 17 +++++++++++++++++ .../devops/backup_manager/audit/README.md | 19 +++++++++++++++++-- 2 files changed, 34 insertions(+), 2 deletions(-) diff --git a/subjects/devops/backup_manager/README.md b/subjects/devops/backup_manager/README.md index 6a60c584..9c2b64f4 100644 --- a/subjects/devops/backup_manager/README.md +++ b/subjects/devops/backup_manager/README.md @@ -148,6 +148,23 @@ backup_test.tar office_docs.tar personal_data.tar > There is many ways to run tasks in background and to perform actions on a specific time, the implementation proposed in this exercise is good for learning but should not be your preferred choice for production environments. +**.tar files** + +In Linux, tar is a command-line utility used to create, manipulate and extract .tar (tape archive) files. Here are some common operations you can perform with .tar files using the tar command: + +- To create a .tar file: + `tar -cvf archive.tar file1 file2 directory1/` +- To extract the contents of a .tar file: + `tar -xvf archive.tar` +- To extract a specific file from a .tar file: + `tar -xvf archive.tar file1` +- To compress a .tar file using gzip: + `tar -cvzf archive.tar.gz file1 file2 directory1/` +- To list the contents of a tar file: + `tar tf archive.tar` +- To list the contents of a tar archive in a long listing format: + `tar -tvf archive.tar` + ### References - [Error handling in Python](https://docs.python.org/3.10/tutorial/errors.html) diff --git a/subjects/devops/backup_manager/audit/README.md b/subjects/devops/backup_manager/audit/README.md index 84822e8d..6548ddd9 100644 --- a/subjects/devops/backup_manager/audit/README.md +++ b/subjects/devops/backup_manager/audit/README.md @@ -57,7 +57,13 @@ $ python3 ./backup_manager.py list ##### Verify that the following command runs without errors: `python3 backup_manager.py start`. -###### Can you confirm that the `backup_service.py` process is running? (For example you could use `ps -ef | grep backup_service`). +###### Can you confirm that the `backup_service.py` process is running? (For example you could use `ps -ef | grep backup_service`). Check the example bellow: + +```bash +$ python3 ./backup_manager.py start +$ -ps -ef | grep backup_service +user 1520028 2736 0 18:30 ? 00:00:00 python3 ./backup_service.py start & +``` ##### Now run the command `python3 backup_manager.py start` again. @@ -107,7 +113,16 @@ $ cat logs/backup_service.log [13/02/2023 18:21] Backup done for testing in backups/backup_test.tar ``` -##### Follow the example above and then open the `backup_test.tar` file to ensure that the backup process was successful. Verify that the files are not empty or damaged and that it matches the original directory. +##### Follow the example above and then open the `backup_test.tar` file to ensure that the backup process was successful. Verify that the files are not empty or damaged and that it matches the original directory. The result should be similar to the following example: + +```console +$ ls +backup_test.tar +$ tar -tvf backup_test.tar +drwxrwxr-x user/user 0 2023-04-19 10:23 testing/ +-rw-rw-r-- user/user 0 2023-04-19 10:23 testing/1 +-rw-rw-r-- user/user 0 2023-04-19 10:23 testing/2 +``` ###### Was the backup created successfully?