Let us first look at a simple and powerful archive mechanism. Let's analyze a convenient script called ARC, which allows us to create a backup snapshot in the Linux shell prompt.
Listing 1. ARC shell script
#! / bin / sh
TAR CZVF $ 1. $ (DATE % Y% M% D% -h% M% s) .TGZ $ 1
EXIT $?
The ARC script receives a separate file or directory name as a parameter, creates a compressed archive file, and embed the current date into the name of the generated archive file. For example, if you have a directory named Beoserver, you can call the Arc script to pass the Beisterver directory name to create a compressed archive file, such as: Beoserver.20040321-014844.tgz
Use the date command to embed a date and timestamp to help you organize the archive file. The date of the date is the year, month, day, hour, minute, second - although there are more than the use of the spine. View the man name of the data command to find out other options. In addition, in Listing 1, we pass the -v (Verbose) option to the TAR. This makes the TAR show that it is archiving files. If you prefer to back up silently, remove this -V option.
Listing 2. Archive Beoserver directory
$ ls
Arc Beisterver
$ ./ARC beoserver
Beoserver /
Beoserver / bookl.dat
Beoserver / beoServer_ab_off
Beoserver / beoServer_ab_on
$ ls
Arc beoserver beoserver.20040321-014844.tgz