Creating a backup file (BackUp file) in BASH. Part 1: Working with time in BASH. The date function.

Опубликовано: 01 Январь 1970
на канале: Официальный Интернет
381
20

In this video, we will continue writing the script for automatic deployment of a full-featured WEB server on BASH.

The video was randomly generated in two parts. (Just freaked out during installation.) =D

In this (first) part, the BASH function of working with date and time is considered.
This date function allows you to get the current date and time in various formats.

In order to choose the appropriate format for displaying the date and time, the easiest way is to read the help of this function, located directly in the operating system.

The date and time formats discussed in the video, which are obtained from the date system function in BASH, are not the only way to work with time in Unix. This function has many parameters that allow you not only to work with the current time and date values, but also to convert the date and time to the desired format. However, to write a script, a small specific functionality is enough, which allows you to quickly and easily form a suffix for the file name of the backup being called.

For a more complete review of the necessary functionality of the data system function, I strongly recommend that you read, if not the manual, then at least help, which allows you to quickly find and change the output of the date and time in the required format.

In the next part, we will continue writing a full-fledged function that will take two parameters as input (the name and path to the file that you want to backup + the name of the directory where you want to put an exact copy of this file).

To be continued! ;)

USEFUL LINKS TO ARTICLES WITH DETAILED INSTRUCTIONS:

1. Articles on Bash programming - https://mb4.ru/programming/bash.html
2. Articles on Unix (using Debian as an example) - https://mb4.ru/operating-system/unix....
3. Articles about PuTTY - https://mb4.ru/programms/programs-for...
4. For those who decided to take their own server - https://mb4.ru/hosting/firstvds.html

For cooperation: https://mb4.ru/support.html


#automation #format #file #server #unix #date #time #BackUp #file #help #backup #function #bash