Write a script take-backup.sh which we can run as following:- $ take-backup.sh –enable-logging=yes <source_folder>
$ take-backup.sh –enable-logging=no <source_folder> Above command would treat <source_folder> as the source folder, create a tar of it and move it under /mnt with some file like <source_folder>----.tar
Also if the logging is enabled then it should print the message like following in with journalctl
Took the backup of <source_folder> and saved it as /mnt/<source_folder>-<hour>-<min>-<month>-<year>.tar
If logging is not enabled then it should not log.
Also by-default logging is enabled.
For example $ take-backup.sh –enable-logging=yes mycode
where mycode is folder name in the current working directory. It should create a file like mycode-23:55-10-2022.tar in the /mnt folder and log following:-
Took the backup of “mycode” and saved it as /mnt/mycode-23:55-10-2022.tar
source code: https://snippi.com/s/q55ylqo