Write a bash script createDirectories.sh that when the script is executed with three given arguments (one is the directory name second is the start number of directories and third is the end number of directories ) it creates a specified number of directories with a dynamic directory name.
Create a Script to backup all your work done till now.
Read about Cron and Crontab, to automate the backup Script
Cron :
Cron is a Linux job scheduler that is used to set up tasks to run periodically at a fixed date or interval. Cron jobs are specific commands or shell scripts that users define in the crontab files. These files are then monitored by the Cron daemon and jobs are executed on a pre-set schedule.
Crontab:
- The crontab is a list of commands that you want to run on a regular schedule. Crontab stands for “cron table, ” because it uses the job scheduler cron to execute tasks. It runs a task or process at a given date and time.
crontab -e: Edits a copy of the user's crontab file or creates an empty file to edit if the crontab file does not exist for a valid UserName. When editing is complete, the file is copied into the crontab directory as the user's crontab file.
crontab -l: Lists the user's crontab file.
crontab -r: Remove the user's crontab file from the crontab directory.
crontab -v: Lists the status of the user's cron jobs.
Using Cron and Crontab, to automate the backup Script and update a log file that "backup is completed" :
In the below script, the backup will be completed every 12 hours.