๐ปDay 5 - Advanced Linux Shell Scripting for DevOps Engineers with User management

Hey there! ๐
I'm Pratik R. Mandge, a DevOps Engineer passionate about all things AWS DevOps Technology. Currently on a learning adventure, I'm here to share my journey and Blog's in the world of cloud and DevOps.
๐ ๏ธ My focus? Making sense of AWS services, improving CI/CD, and diving into infrastructure as code. Whether you're fellow interns or curious enthusiasts, let's grow together in the vibrant DevOps space.
๐ Connect with me for friendly chats, shared experiences, and learning moments. Here's to embracing the learning curve and thriving in the exciting world of AWS DevOps Technology!
Follow me on LinkedIn: https://www.linkedin.com/in/pratik-mandge363
Let's we have a some tasks for day-5,
๐Task 1: Bash Script to Create Dynamic Directories.
Example 1:
Creates 90 directories as day1 day2 day3....day90 using loop

The +x option specifically sets the execute permission on a file, allowing it to be run as a program.
Run the ./createDirectories.sh file.

Example 2:
Creates 30 directories as Movie20 Movie21 Movie23....Movie50 using loop

The +x option specifically sets the execute permission on a file, allowing it to be run as a program.
Run the ./createDirectories.sh Movie 20 50 file.

๐Task 2: Create a Script to backup all your work done till now.
**Backups are an important part of DevOps Engineer's Day to Day activities.**
Now let's create the backup.sh, a file which we can run and create the backup of the contents that are present in scripts directory.

By using tar command to archive and also compress the file to create a backup file.
Execution of the backup.sh, you get the following result :

๐ Cron and Crontab
โผ๏ธ Cron is a time-based job scheduler in Unix-like operating systems. It is used to schedule jobs to run at specific times or dates.
โผ๏ธ Crontab is a file that contains a list of cron jobs.
The syntax for a crontab entry is as follows:
minute hour day month day_of_week command
OR
* * * * *

Some useful commands crontab commands to use in the terminal :
crontab -e: Edit the crontab file, or create one if it doesnโt already exist.crontab -l: Display crontab file contents.crontab -r: Remove your current crontab file.crontab -i: Remove your current crontab file with a prompt before removal.
โผ๏ธThe example of crontab entry:
# Run a backup script every Sunday at 6:00 AM
0 6 * * 0 /path/to/backup-script.sh
โผ๏ธExplanation:
0- Minute field, specifying that the task should run when the minute is 0 (on the hour).6- Hour field, specifying that the task should run at 6 AM.*- Wildcard character, meaning "every" for the day of the month and month fields.0- Day of the week field, specifying that the task should run on Sunday./path/to/backup-script.sh- The command or script to be executed.
In this example, the backup script will run every Sunday at 6:00 AM. You can adjust the fields to schedule tasks at different times or on different days. The cron syntax allows for a high degree of flexibility in defining when tasks should be executed.
๐ User Management & it's Example in Linux
User management in Linux involves creating, modifying, and deleting user accounts, as well as managing user-related settings and permissions. Here are some commonly used commands for user management:
โผ๏ธCreating a User: To add a new user, you can use the adduser or useradd command.

โผ๏ธSetting Password: To set a password for the user, use the passwd command.
passwd username
โผ๏ธDeleting a User: To remove a user, use the userdel command.
userdel username
โผ๏ธDisplay the Username: To display username use below commands.



๐Conclusion
The Advanced Linux Shell Scripting course for DevOps Engineers, focusing on user management, equips professionals with crucial skills. Graduates master creating, modifying, and automating user accounts for secure access. This expertise in advanced scripting enhances efficiency and scalability. DevOps Engineers are empowered to manage Linux environments effectively, troubleshoot issues, and contribute to dynamic initiatives within their organizations.
I'm confident that this blog will prove to be valuable, helping you discover new insights and learn something enriching .๐
๐Happy Learning : )




