Exploring Advanced Shell Scripting ๐
Automatic Directory Creation Magic ๐ฉโจ
If you've ever wondered how I created 90 directories, it's done in seconds with a simple command:
command: mkdir day{1..90}
1: Create Directories with a Bash Script ๐๐
Let's turn that command into a dynamic bash script, createDirectories.sh
, allowing you to create a specified number of directories with a custom name.
Execute with:
chmod createDirectories.sh
./createDirectories.sh day 1 90
2: Script to Backup Your Work ๐๐พ
Backups are essential! Create a script, backupScript.sh
, to back up all your work.
3: Automate Backups with Cron ๐โฐ
Explore Cron and Crontab to automate your backup script. Schedule tasks at specific intervals for unattended execution.
Cron โฐ: Cron is like the timekeeper for your Linux system. It helps you schedule and automate tasks at specific times or intervals. Imagine it as your system's personal assistant that knows when to perform certain actions without you manually triggering them.
Crontab ๐๏ธ: Crontab is the schedule manager. It's like a to-do list for your system tasks. You use it to set up the when and what for your scheduled jobs. Think of it as your system's planner, where you jot down the times and tasks it needs to handle.
In short, Cron is the clock, and Crontab is the schedule it follows! โฐ๐๏ธ
4: User Management ๐งโ๐ป๐
Create two users and display their usernames using the following commands:
commands:
sudo adduser user1
sudo adduser user2
Display Usernames:
command: awk -F':' '{ print $1}' /etc/passwd | tail -n 2
Reflections on Day 5 ๐ค๐
What a journey! ๐ Day 5 brought automation magic with directory creation, the safety net of backups, and a glimpse into user management. These skills are the building blocks of a resilient DevOps journey. ๐ ๏ธ๐ป