0
0
Bash Scriptingscripting~5 mins

Backup automation script in Bash Scripting - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is the main purpose of a backup automation script?
To automatically copy important files or folders to a safe location regularly, so data is protected against loss.
Click to reveal answer
beginner
In a bash backup script, what command is commonly used to copy files and directories?
The rsync command is commonly used because it efficiently copies and synchronizes files and directories.
Click to reveal answer
intermediate
Why is it important to check if the backup destination directory exists in a script?
To avoid errors during backup, the script should check if the destination folder exists and create it if it does not.
Click to reveal answer
intermediate
What does the following bash snippet do? <br>
if [ ! -d "$backup_dir" ]; then mkdir -p "$backup_dir"; fi
It checks if the directory stored in $backup_dir does not exist, and if so, creates it including any needed parent directories.
Click to reveal answer
beginner
How can you schedule a backup automation script to run daily on a Linux system?
You can use cron to schedule the script. Adding a cron job with crontab -e lets you run the script at set times automatically.
Click to reveal answer
Which command is best for syncing files in a backup script?
Arsync
Bcat
Cecho
Dgrep
What does the -p option do in mkdir -p?
ACreates parent directories as needed
BPrints the directory path
CPrompts before creating
DProtects the directory
Why should a backup script check if the destination folder exists?
ATo encrypt files
BTo delete old backups
CTo speed up the script
DTo avoid errors during file copying
Which tool schedules scripts to run automatically on Linux?
Atar
Bcron
Cssh
Dvim
What is a safe place to store backup files?
ATemporary system folder
BSame folder as original files
CSeparate drive or external storage
DDesktop
Explain how a simple bash backup automation script works.
Think about the steps to safely copy files regularly.
You got /4 concepts.
    Describe how to schedule a backup script to run every day at 2 AM using cron.
    Focus on the cron time format and command.
    You got /4 concepts.