0
0
Bash Scriptingscripting~5 mins

Log rotation script in Bash Scripting - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is the main purpose of a log rotation script?
A log rotation script automatically renames, compresses, or deletes old log files to save disk space and keep logs organized.
Click to reveal answer
beginner
In a log rotation script, why do we compress old log files?
Compressing old log files reduces their size, saving disk space while keeping the logs accessible if needed.
Click to reveal answer
beginner
What does the command mv logfile logfile.1 do in a log rotation script?
It renames the current log file to logfile.1, marking it as the first rotated log file.
Click to reveal answer
beginner
Why is it important to create a new empty log file after rotating the old one?
Creating a new empty log file allows the system or application to continue writing logs without interruption.
Click to reveal answer
beginner
What does the gzip command do in the context of log rotation?
The gzip command compresses the rotated log file to save disk space.
Click to reveal answer
What is the first step in a basic log rotation script?
ACompress the new log file
BDelete all log files
CRename the current log file
DCreate a backup of the system
Why do we create a new empty log file after rotating?
ATo stop logging
BTo allow logging to continue
CTo delete old logs
DTo compress logs
Which command compresses a file in a log rotation script?
Agzip
Brm
Cmv
Dtar
What happens if you don’t rotate logs regularly?
ADisk space may fill up
BLogs get deleted automatically
CLogs become compressed
DNothing changes
Which command renames a file in bash?
Acp
Btouch
Crm
Dmv
Explain the steps involved in a simple log rotation script.
Think about how to keep logs organized and save space.
You got /3 concepts.
    Why is log rotation important for system maintenance?
    Consider what happens if logs grow without limit.
    You got /3 concepts.