June 2025
Beginner to intermediate
1180 pages
37h 48m
English
This section focuses on real-life examples. The following script synchronizes the contents of the local data directory with the directory of the same name on an external hard disk called backup. The script tests whether the external hard disk is available. If it isn’t, the backup will not be performed:
#!/bin/bashif [ -d /media/backup/ ]; then rsync -avW --delete /home/kofler/data /media/backup/fi
As a rule, you will run backup scripts automatically on a regular basis. The easiest way to do this is to set up a Cron job. To do so, it’s easiest to save the script directly in a Cron directory—for example, under the /etc/cron.daily/mybackup filename. Please note that the filename must not contain a dot and that the file must ...
Read now
Unlock full access