We share with you a script prepared by one of our readers to carry out backup copies automatically. One more chance to learn to use the terminal and develop scripts customized. 🙂 |
Functionality
- Make backups using the rsync command.
- Use a bash script.
- The current version only allows use locally.
Requirements and Installation
For the script to work, the system must have the gdialog application.
It does not require installation, simply place the script in the $ HOME / .copies / directory. This parameter is located in the variable script_directory and can be changed.
Selecting the source and destination directories for the copy
In the current version they are specified by editing the copies.sh script. The format used makes use of the -acv and -delete options.
For example:
rsync -acv --delete $ user_directory'directory_to_backup '$ target_directory
where we will replace directory_to_back up with the name of the desired directory.
The variable $ user_directory is assigned a value in the script.
The variable $ destination_directory is assigned the value read in copies.cfg
Configuration file
The configuration file is called copies.cfg and is located in the directory $ HOME / .copies /
Configuration file structure
The second line specifies the destination of the backup:
#Destination / media / Iomega_HDD /
Files Accessories
The copy_ini.sh script file checks if backups have been made with a periodicity interval. Currently there is no parameter in the configuration file to specify this, which is set in the same script daily.
Automate the backup process
1.- Put in cron with the crontab -e command in a similar way to the following:
# mh dom mon dow command
0 20 * * * DISPLAY = »: 0 ″ /home/user/.copies/copias.sh
In this example, the execution of the script would be launched at 20:00 hours each day
2.- Add to the programs to be executed at the beginning the script copies_ini.sh indicating the full path to it
The good thing about Deja Dup is that it has encryption to save the files, it is very good, but to this script you can add that with gnupg + split and it is almost the same.
Nice article guys.
Sure ... for those who want to use a graphical interface ...
Others prefer to do it "the old fashioned way"
Cheers! Paul.
2012/11/30
It's easier Deja-Dup
Hello, and if I want to do the backup on a PC connected to the same network. How would you put the destination in the config file?