Day 5 Task: Advanced Linux Shell Scripting for DevOps Engineers with User management
1.Create Directories.sh
- You have to do the same using Shell Script i.e using either Loops or command with start day and end day variables using arguments -
So Write a bash script create directories.sh that when the script is executed with three given arguments (one is the directory name and second is start number of directories and third is the end number of directories ) it creates a specified number of directories with a dynamic directory
Create a Script to backup all your work done till now
Creating a backup all your work is important for several reasons
Preventing Data Loss
Security AgainstAccidentsProtection from
Hardware Failures
Coping with Cyber Threats
Peace of Mind
Here I have written one shell script, which will create the backup of the directory in compressed format,
About Cron and Crontab, to automate the backup Script
Cron:
What is Cron:It is a time-based job scheduler in Unix-like operating systems.
What it does: It allows you to schedule tasks or jobs to run automatically at specified intervals (e.g., every day at midnight).
Why it's useful: It helps automate repetitive tasks, ensuring they are performed at specific times without manual intervention.
Crontab:
What is Crontab: (short for cron table) is a configuration file that defines the schedule of cron jobs for a user.
What it does: It specifies when and how often certain commands or scripts should run.
Why it's useful: It provides a convenient way to schedule and manage automated tasks, allowing users to define a schedule for their jobs without needing to remember the exact syntax every time.
The syntax for a crontab entry is composed of five fields that define when a task should run and a command to execute. Here's the basic syntax:
This is how we can schedule the job
About User Management:
User management in Linux involves creating, modifying, and deleting user accounts, as well as managing user permissions and groups. Here are some common commands and concepts related to user management in a Linux environment:
Creating Users and Groups:
-
Users and Groups Created:
-
Changing groups of existing files or adding user to group